Merge pull request #1097 from sveltejs/gh-1082-b

fix escaping of sigils in SSR non-top-level <script> and <style>
pull/1099/merge
Rich Harris 7 years ago committed by GitHub
commit 8057884cb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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);

Loading…
Cancel
Save