Skip to content
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

fix: ensure child node is a child of parent before removing #1

Closed
wants to merge 1 commit into from

Conversation

shama
Copy link
Owner

@shama shama commented Aug 24, 2023

Fixes glimmerjsGH-1401

If current isn't a child of parent calling parent.removeChild(current) will result in the error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. This commonly occurs when the DOM is externally modified by a browser, such as when translating a page. The nextSibling may not be a child node of parent.

current.parentNode?.removeChild(current) ensures we are only removing a child node of a parent node.

Fixes glimmerjsGH-1401

If `current` isn't a child of `parent` calling `parent.removeChild(current)` will result in the error: `Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node`. This commonly occurs when the DOM is externally modified by a browser, such as when translating a page. The `nextSibling` may not be a child node of `parent`.

`current.parentNode?.removeChild(current)` ensures we are only removing a child node of a parent node.
@shama shama closed this Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
1 participant