Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the effect of parent.insertBefore(child,child) — in other words, of trying to insert a node before itself?

child insert Node words
0
Posted

What is the effect of parent.insertBefore(child,child) — in other words, of trying to insert a node before itself?

0

The child node should be removed from its parent, then reinserted in the same place, as if the call had actually been parent.insertBefore(child,child.getNextSibling()). Note that this is not considered a usage error; no DOMexception is thrown. Nor is it necessarily a “no-op” even though the document is left unchanged, since the removal and reinsertion may have side effects — for example, MutationEvents may be fired, and NodeIterator and Range fixups may occur.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123