mirror of https://github.com/sveltejs/svelte
fix: escape more template-literal-related characters (#13262)
* fix: escape more template-literal-related characters Escape `{` at the start of a string, because it could be preceeded by a `$`, which in combination loads to the following characters being treated as a value Fixes #13258 (used the opportunity to merge closely-related tests into one) * sanitize template strings once assembled (#13263) * only sanitize template quasis once assembled * changeset * remove old changeset --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/13257/head
parent
d9369d8e30
commit
9864138022
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: wait until template strings are complete before sanitizing
|
@ -1,5 +1,8 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: '<code>`${foo}\\n`</code>\n`\n<div title="`${foo}\\n`">foo</div>\n<div>`${foo}\\n`</div>'
|
||||
html:
|
||||
'<code>`${foo}\\n`</code>\n`\n<div title="`${foo}\\n`">foo</div>\n<div>`${foo}\\n`</div>' +
|
||||
'<div>/ $clicks: 0 `tim$es` \\</div><div>$dollars `backticks` pyramid /\\</div>' +
|
||||
'<p>${ ${ ${</p>'
|
||||
});
|
||||
|
@ -1,5 +0,0 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: '<div>/ $clicks: 0 `tim$es` \\</div><div>$dollars `backticks` pyramid /\\</div>'
|
||||
});
|
@ -1,6 +0,0 @@
|
||||
<div>
|
||||
/ $clicks: {0} `tim${"e"}s` \
|
||||
</div>
|
||||
<div>
|
||||
$dollars `backticks` pyramid /\
|
||||
</div>
|
Loading…
Reference in new issue