Skip to content

Commit c641ce4

Browse files
authored
Quote name of attribute to nested components
This fixes sveltejs#887 by quoting name of attributes if those are invalid JS identifiers when passing data to nested components.
1 parent 17000e3 commit c641ce4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compile/nodes/Component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export default class Component extends Node {
148148
const attributeObject = usesSpread
149149
? '{}'
150150
: stringifyProps(
151-
this.attributes.map(attr => `${attr.name}: ${attr.getValue()}`)
151+
this.attributes.map(attr => `${quoteNameIfNecessary(attr.name)}: ${attr.getValue()}`)
152152
);
153153

154154
if (this.attributes.length || this.bindings.length) {

0 commit comments

Comments
 (0)