Latest: buggy behaviour of parent:: in PHP 5.3.3

Content with Style

Web Technique

Swapping nodes in a DOM tree

by Pascal Opitz on April 12 2007, 09:34

I was quite surprised to find out that the insertBefore method actually does most of the job for you.
A detail in the manual offers us insight in how: "If the newChild is already in the tree, it is first removed."


myNode.parentNode.insertBefore(myNode, myNode.nextSibling);


  • haha, the manual.
    That is actually quite nice to know. Is it implemented correctly in all the usual PHP, JS, different browsers whatever? And when can I add Ruby (on, over, under or without Rails) to that list?

    by Matthias on April 13 2007, 13:46 - #

Leave your comment

Comments are moderated.
Tags allowed: a, strong, em, code, ul, ol, li, q, blockquote, br, p