fix escaping of sigils in SSR non-top-level <script> and <style>

pull/1097/head
Conduitry 7 years ago
parent 2537db90be
commit 7ee44af6b5

@ -7,6 +7,7 @@ import Element from '../../nodes/Element';
import Block from '../Block'; import Block from '../Block';
import { Node } from '../../../interfaces'; import { Node } from '../../../interfaces';
import stringifyAttributeValue from './shared/stringifyAttributeValue'; import stringifyAttributeValue from './shared/stringifyAttributeValue';
import { escape } from '../../../utils/stringify';
export default function visitElement( export default function visitElement(
generator: SsrGenerator, generator: SsrGenerator,
@ -61,7 +62,7 @@ export default function visitElement(
if (node.name === 'textarea' && textareaContents !== undefined) { if (node.name === 'textarea' && textareaContents !== undefined) {
generator.append(textareaContents); generator.append(textareaContents);
} else if (node.name === 'script' || node.name === 'style') { } else if (node.name === 'script' || node.name === 'style') {
generator.append(node.data); generator.append(escape(node.data));
} else { } else {
node.children.forEach((child: Node) => { node.children.forEach((child: Node) => {
visit(generator, block, child); visit(generator, block, child);

Loading…
Cancel
Save