diff --git a/src/generators/server-side-rendering/visitors/shared/stringifyAttributeValue.ts b/src/generators/server-side-rendering/visitors/shared/stringifyAttributeValue.ts index 22eb0eff7645..d2df80beabed 100644 --- a/src/generators/server-side-rendering/visitors/shared/stringifyAttributeValue.ts +++ b/src/generators/server-side-rendering/visitors/shared/stringifyAttributeValue.ts @@ -11,7 +11,7 @@ export default function stringifyAttributeValue(block: Block, chunks: Node[]) { block.contextualise(chunk.expression); const { snippet } = chunk.metadata; - return '${' + snippet + '}'; + return '${__escape(' + snippet + ')}'; }) .join(''); } \ No newline at end of file diff --git a/test/runtime/samples/attribute-dynamic-quotemarks/_config.js b/test/runtime/samples/attribute-dynamic-quotemarks/_config.js new file mode 100644 index 000000000000..b9f436462439 --- /dev/null +++ b/test/runtime/samples/attribute-dynamic-quotemarks/_config.js @@ -0,0 +1,3 @@ +export default { + html: `foo` +}; diff --git a/test/runtime/samples/attribute-dynamic-quotemarks/main.html b/test/runtime/samples/attribute-dynamic-quotemarks/main.html new file mode 100644 index 000000000000..b5c3be5bbd74 --- /dev/null +++ b/test/runtime/samples/attribute-dynamic-quotemarks/main.html @@ -0,0 +1 @@ +foo