-
Notifications
You must be signed in to change notification settings - Fork 3
Prevent removeChild exception #2
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
base: master
Are you sure you want to change the base?
Conversation
I dont know the need behind the use of But I would recommand to use of the following, instead function fragment(node) {
node.parentElement.appendChild(document.adoptNode(node).content);
} That will produce a more clean domtree close to what we wanted at start. sveltejs/svelte#2080 The node adoption make sense because the template tag will not be reuse in the context. It the one time use. And given the slot use, it should not be use in another context. I will personnaly strongly stand in favor of |
Well. I found out the why of the I focused my self on the Sapper routing, but conditional rendering and loop are involed too. edit: From : https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment#Usage_notes
That's why we can't remove child from an used fragment. |
Here is the workaround I found. |
Following a weird behavior of Sapper. This feature should be needed too. Because of SSR, I would love to not necessarly use a template element as slot node. |
This fix the
exception occuring when changing route using Sapper.
This occur because of the deletetion of the node in the DOM before of the
destroy
lifecycle being called.fix #1