Bugzilla – Bug 17706
Node.replaceChild(node, child) doesn't check that child is among node's children
Last modified: 2012-07-06 05:15:52 UTC
DOM4 Editor's Draft states:
To replace a child with node within a parent, run these steps:
Remove child from its parent with the suppress observers flag set.
The problem is child's parent may not be the same parent as the insertion parent. The word "its" in this last sentence makes that possible.
Sorry, folks, I was reading a different part of my code. This is covered by step 1 in the replaceChild algorithm:
If child's parent is not parent, throw a "NotFoundError" exception and terminate these steps.