fix: escape closing script tag

if a svelte app is inlined to a browser (i.e. stuffed in between `<script>...</script>` tags instead of loaded remotely), this tag is parsed as a valid closing script tag.
pull/6822/head
Brian Whitton 5 years ago committed by GitHub
parent a5968dd2d0
commit d58d23e2f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -602,7 +602,7 @@ export function add_resize_listener(node: HTMLElement, fn: () => void) {
let unsubscribe: () => void; let unsubscribe: () => void;
if (crossorigin) { if (crossorigin) {
iframe.src = "data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>"; iframe.src = "data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>";
unsubscribe = listen(window, 'message', (event: MessageEvent) => { unsubscribe = listen(window, 'message', (event: MessageEvent) => {
if (event.source === iframe.contentWindow) fn(); if (event.source === iframe.contentWindow) fn();
}); });

Loading…
Cancel
Save