From 707405af7a7532f683a2dfc766aaf12ed1ca77df Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 22 Sep 2017 10:31:59 -0400 Subject: [PATCH] fix sigil escaping in .textContent and .innerHTML (#868) --- src/generators/dom/visitors/Element/Element.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/generators/dom/visitors/Element/Element.ts b/src/generators/dom/visitors/Element/Element.ts index 8b42d40a18..fe874790d0 100644 --- a/src/generators/dom/visitors/Element/Element.ts +++ b/src/generators/dom/visitors/Element/Element.ts @@ -16,6 +16,7 @@ import Block from '../../Block'; import { Node } from '../../../../interfaces'; import { State } from '../../interfaces'; import reservedNames from '../../../../utils/reservedNames'; +import { stringify } from '../../../../utils/stringify'; const meta = { ':Window': visitWindow, @@ -205,11 +206,11 @@ export default function visitElement( if (!childState.namespace && node.canUseInnerHTML && node.children.length > 0) { if (node.children.length === 1 && node.children[0].type === 'Text') { block.builders.create.addLine( - `${name}.textContent = ${JSON.stringify(node.children[0].data)};` + `${name}.textContent = ${stringify(node.children[0].data)};` ); } else { block.builders.create.addLine( - `${name}.innerHTML = ${JSON.stringify(node.children.map(toHTML).join(''))};` + `${name}.innerHTML = ${stringify(node.children.map(toHTML).join(''))};` ); } } else {