From a03566e4f932fddd61f7ef3793c9c70e65215234 Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sat, 3 Aug 2019 13:15:32 -0400 Subject: [PATCH] prevent commas in attributes - fixes #3341 --- .../compile/render_dom/wrappers/Element/Attribute.ts | 2 +- .../samples/innerhtml-interpolated-literal/_config.js | 7 +++++++ .../samples/innerhtml-interpolated-literal/main.svelte | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/runtime/samples/innerhtml-interpolated-literal/_config.js create mode 100644 test/runtime/samples/innerhtml-interpolated-literal/main.svelte diff --git a/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts b/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts index f83b1f2acf56..a05898c437c7 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts @@ -240,7 +240,7 @@ export default class AttributeWrapper { return chunk.type === 'Text' ? chunk.data.replace(/"/g, '\\"') : `\${${chunk.render()}}`; - })}"`; + }).join('')}"`; } } diff --git a/test/runtime/samples/innerhtml-interpolated-literal/_config.js b/test/runtime/samples/innerhtml-interpolated-literal/_config.js new file mode 100644 index 000000000000..a98ed85345c6 --- /dev/null +++ b/test/runtime/samples/innerhtml-interpolated-literal/_config.js @@ -0,0 +1,7 @@ +export default { + html: ` +
+ +
+ ` +} \ No newline at end of file diff --git a/test/runtime/samples/innerhtml-interpolated-literal/main.svelte b/test/runtime/samples/innerhtml-interpolated-literal/main.svelte new file mode 100644 index 000000000000..8a3c9272a5b6 --- /dev/null +++ b/test/runtime/samples/innerhtml-interpolated-literal/main.svelte @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file