The before, after and replaceWith methods of ChildNode instances don't behave well when its arguments contain sibling nodes or the node on which the method is called. This is because the index on which to insert the nodes in the parent is computed before nodesAndTextNodes is called, which removes the passed nodes from their parents, thus invalidating the index.
The
before
,after
andreplaceWith
methods ofChildNode
instances don't behave well when its arguments contain sibling nodes or the node on which the method is called. This is because the index on which to insert the nodes in the parent is computed beforenodesAndTextNodes
is called, which removes the passed nodes from their parents, thus invalidating the index.