public function __construct($dom, $node = false) { $this->_dom = $dom; $this->_node = $node; $this->_guid = b::guid("domref"); $this->attr('data-domref', $this->_guid); }
public function offsetSet($name, $value) { $el = $this->find($name)->first(); if ($el->hasChildNodes()) { foreach ($el->childNodes as $child) { $child->parentNode->removeChild($child); } } if (stripos($value, '<') !== false and stripos($value, '>') !== false) { $guid = b::guid("_x_dom"); $_ = new \DOMDocument(); $_->loadHTML("<div id='{$guid}'>" . $value . "</div>"); $children = $_->getElementById($guid)->childNodes; foreach ($children as $child) { $el->appendChild($this->_doc->importNode($child, true)); } } else { $el->appendChild(new \DOMText($value)); } return $this; }