-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page <head> content is replaced when <svelte:head> starts with {@html ...} #2805
Comments
Looks like if you start |
So I've tracked this down to svelte/src/compile/render-dom/wrappers/RawMustacheTag.ts Lines 40 to 43 in 21d56c9
I believe the condition should be something equivalent to: if (anchor_before === 'null' && anchor_after === 'null' && parent_node !== 'document.head') { That doesn't seem like a good way to achieve it, but something to the same effect. I don't have a good picture of how the compiler works, but I'm thinking it should consult the parent node's |
Released 3.4.4 with @cudr's fix |
If
<svelte:head>
starts with{@html ...}
and has additional elements after it, you get a runtime error. Try switching the order in this REPL example, or put any tag before the{@html ...}
, and it works: https://svelte.dev/repl/5f5a4608cf10419a832d83c3eb5b695a?version=3.4.1Chrome:
Uncaught DOMException: Failed to execute 'insertAdjacentHTML' on 'Element': The element has no parent.
Safari:
NoModificationAllowedError: The object can not be modified.
Firefox:
NoModificationAllowedError: Modifications are not allowed for this document
The text was updated successfully, but these errors were encountered: