public function process($content) { if (strlen($content) == 0) { return ''; } $fragment = $this->html5->loadHTMLFragment($content); $fragment = $this->processModifiers($fragment); return $this->html5->saveHTML($fragment); }
/** * Write the QueryPath document to HTML5. * * See html() */ function html5($markup = NULL) { $html5 = new HTML5($this->options); // append HTML to existing if (isset($markup)) { // Parse the HTML and insert it into the DOM $doc = $html5->loadHTMLFragment($markup); $this->removeChildren(); $this->append($doc); return $this; } $length = $this->size(); if ($length == 0) { return NULL; } // Only return the first item -- that's what JQ does. $first = $this->getFirstMatch(); // Catch cases where first item is not a legit DOM object. if (!$first instanceof \DOMNode) { return NULL; } // Added by eabrand. if (!$first->ownerDocument->documentElement) { return NULL; } if ($first instanceof \DOMDocument || $first->isSameNode($first->ownerDocument->documentElement)) { return $html5->saveHTML($this->document); //$this->document->saveHTML(); } return $html5->saveHTML($first); }