Skip to content

Commit 976f2a9

Browse files
authored
Merge pull request #1429 from sveltejs/input-spread
allow spread props on elements with tests for static attributes
2 parents e8a7806 + fa61d25 commit 976f2a9

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/utils/getStaticAttributeValue.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Node } from '../interfaces';
22

33
export default function getStaticAttributeValue(node: Node, name: string) {
44
const attribute = node.attributes.find(
5-
(attr: Node) => attr.name.toLowerCase() === name
5+
(attr: Node) => attr.type === 'Attribute' && attr.name.toLowerCase() === name
66
);
77

88
if (!attribute) return null;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export default {
2+
data: {
3+
props: {
4+
'data-foo': 'bar'
5+
}
6+
},
7+
8+
html: `<input data-foo="bar">`
9+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<input bind:value {...props}>

0 commit comments

Comments
 (0)