Example #1
0
 /**
  * Append nodes as children to the node itself
  *
  * @param mixed $nodes
  */
 public function append($nodes)
 {
     /** @var \DOMNode|Implementation $this */
     if ($nodes = MutationMacro::expand($this, $nodes)) {
         $this->appendChild($nodes);
     }
 }
Example #2
0
 /**
  * Insert nodes after a node.
  *
  * @param \DOMNode|\DOMNodeList $nodes
  */
 public function after($nodes)
 {
     /** @var \DOMNode|Implementation $this */
     if ($this->parentNode instanceof \DOMElement && ($nodes = MutationMacro::expand($this->ownerDocument, $nodes))) {
         if ($this->nextSibling instanceof \DOMNode) {
             $this->parentNode->insertBefore($nodes, $this->nextSibling);
         } else {
             $this->parentNode->appendChild($nodes);
         }
     }
 }