Merge pull request #1429 from sveltejs/input-spread

allow spread props on elements with tests for static attributes
pull/1436/head
Rich Harris 7 years ago committed by GitHub
commit 976f2a9a99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,7 +2,7 @@ import { Node } from '../interfaces';
export default function getStaticAttributeValue(node: Node, name: string) { export default function getStaticAttributeValue(node: Node, name: string) {
const attribute = node.attributes.find( const attribute = node.attributes.find(
(attr: Node) => attr.name.toLowerCase() === name (attr: Node) => attr.type === 'Attribute' && attr.name.toLowerCase() === name
); );
if (!attribute) return null; if (!attribute) return null;

@ -0,0 +1,9 @@
export default {
data: {
props: {
'data-foo': 'bar'
}
},
html: `<input data-foo="bar">`
};
Loading…
Cancel
Save