diff --git a/src/compiler/compile/render_ssr/handlers/InlineComponent.ts b/src/compiler/compile/render_ssr/handlers/InlineComponent.ts index 320bf5e6a0..74d990a3d8 100644 --- a/src/compiler/compile/render_ssr/handlers/InlineComponent.ts +++ b/src/compiler/compile/render_ssr/handlers/InlineComponent.ts @@ -58,7 +58,7 @@ export default function(node: InlineComponent, renderer: Renderer, options: Rend if (attribute.is_spread) { return snip(attribute.expression); } else { - return `{ ${attribute.name}: ${get_attribute_value(attribute)} }`; + return `{ ${quote_name_if_necessary(attribute.name)}: ${get_attribute_value(attribute)} }`; } }) .concat(binding_props.map(p => `{ ${p} }`)) @@ -67,7 +67,7 @@ export default function(node: InlineComponent, renderer: Renderer, options: Rend } else { props = stringify_props( node.attributes - .map(attribute => `${attribute.name}: ${get_attribute_value(attribute)}`) + .map(attribute => `${quote_name_if_necessary(attribute.name)}: ${get_attribute_value(attribute)}`) .concat(binding_props) ); } diff --git a/test/runtime/samples/prop-quoted/Nested.svelte b/test/runtime/samples/prop-quoted/Nested.svelte new file mode 100644 index 0000000000..681f7126b2 --- /dev/null +++ b/test/runtime/samples/prop-quoted/Nested.svelte @@ -0,0 +1 @@ +{$$props['x-y-z']} \ No newline at end of file diff --git a/test/runtime/samples/prop-quoted/_config.js b/test/runtime/samples/prop-quoted/_config.js new file mode 100644 index 0000000000..d982bc87cc --- /dev/null +++ b/test/runtime/samples/prop-quoted/_config.js @@ -0,0 +1,12 @@ +export default { + props: { + foo: 1 + }, + + html: `1`, + + async test({ assert, component, target }) { + component.foo = 2; + assert.htmlEqual(target.innerHTML, `2`); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/prop-quoted/main.svelte b/test/runtime/samples/prop-quoted/main.svelte new file mode 100644 index 0000000000..0249017762 --- /dev/null +++ b/test/runtime/samples/prop-quoted/main.svelte @@ -0,0 +1,7 @@ + + + \ No newline at end of file