/** * Move the children of this node into this node's parent, just before this node in the DOM tree */ function promote_children() { while ($this->node->hasChildNodes()) { $child = $this->node->firstChild; $this->node->removeChild($child); $this->node->parentNode->insertBefore($child, $this->node); } }