Node.removeChild for Document's direct children doesn't update childNodes #145
Labels
bug
Something isn't working
help-wanted
External contributions welcome
needs investigation
Information is missing and needs to be researched
Milestone
Thanks for this library. I believe I encountered an edge case with Node.removeChild support that isn't working quite right.
If you have a Node that is a direct child of the Document (such as a ProcessingInstruction, DocumentType, Comment, Text, the document Element, etc.), calling
document.removeChild
passing the child node results in the node still being present in the document.childNodes. I ran into this trying to call document.replaceChild to replace a DocumentType, which resulted in the new DocumentType being inserted, but the old DocumentType not being fully removed.It appears that this behavior is because
_removeChild
calls_onUpdateChild
withparentNode.ownerDocument
, and when theparentNode
is a document, theownerDocument
isnull
.Test that demonstrates the behavior:
When I run this test, the first test passes while the second fails.
The text was updated successfully, but these errors were encountered: