Skip to content

Commit

Permalink
Merge pull request #1155 from sveltejs/ssr-escape-attribute-values
Browse files Browse the repository at this point in the history
escape attribute values in SSR
  • Loading branch information
Rich-Harris committed Feb 7, 2018
2 parents 5b9f254 + c481c8d commit 0ef8229
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
}
3 changes: 3 additions & 0 deletions test/runtime/samples/attribute-dynamic-quotemarks/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
html: `<span title='"foo"'>foo</span>`
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span title='{{"\"foo\""}}'>foo</span>

0 comments on commit 0ef8229

Please sign in to comment.