Open t2ym opened 5 years ago
[runtime preprocess][rare use case] Syntax errors with apostrophe ' in id
'
i18n.js
html`${bind(this)}<span id="id-with-apostrophie'">hello</span>`
diff --git a/i18n.js b/i18n.js index 2c17905..3a00222 100644 --- a/i18n.js +++ b/i18n.js @@ -527,7 +527,7 @@ export const html = (strings, ...parts) => { } while (partPath.length) { tmpPart = partPath.shift(); - valueExpression += `['${tmpPart}']`; + valueExpression += `["${tmpPart}"]`; } if (isJSON) { valueExpression = `JSON.stringify(${valueExpression}, null, 2)`;
[runtime preprocess][rare use case] Syntax errors with apostrophe
'
in idRoot Cause
i18n.js
, apostrophe characters are not escaped in generated JavaScript expressionsReproducible Code
Workaround
'
characters in idNotes
Fix