diff --git a/src/generators/server-side-rendering/visitors/Element.ts b/src/generators/server-side-rendering/visitors/Element.ts index db728d6e8d..5978813c0f 100644 --- a/src/generators/server-side-rendering/visitors/Element.ts +++ b/src/generators/server-side-rendering/visitors/Element.ts @@ -7,6 +7,7 @@ import Element from '../../nodes/Element'; import Block from '../Block'; import { Node } from '../../../interfaces'; import stringifyAttributeValue from './shared/stringifyAttributeValue'; +import { escape } from '../../../utils/stringify'; export default function visitElement( generator: SsrGenerator, @@ -61,7 +62,7 @@ export default function visitElement( if (node.name === 'textarea' && textareaContents !== undefined) { generator.append(textareaContents); } else if (node.name === 'script' || node.name === 'style') { - generator.append(node.data); + generator.append(escape(node.data)); } else { node.children.forEach((child: Node) => { visit(generator, block, child);