Skip to content

Commit

Permalink
allow spread props on elements with tests for static attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed May 6, 2018
1 parent e8a7806 commit fa61d25
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/getStaticAttributeValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Node } from '../interfaces';

export default function getStaticAttributeValue(node: Node, name: string) {
const attribute = node.attributes.find(
(attr: Node) => attr.name.toLowerCase() === name
(attr: Node) => attr.type === 'Attribute' && attr.name.toLowerCase() === name
);

if (!attribute) return null;
Expand Down
9 changes: 9 additions & 0 deletions test/runtime/samples/spread-element-input/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
data: {
props: {
'data-foo': 'bar'
}
},

html: `<input data-foo="bar">`
};
1 change: 1 addition & 0 deletions test/runtime/samples/spread-element-input/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<input bind:value {...props}>

0 comments on commit fa61d25

Please sign in to comment.