function DOMTreeBuilder::processingInstruction
Overrides EventHandler::processingInstruction
File
-
vendor/
masterminds/ html5/ src/ HTML5/ Parser/ DOMTreeBuilder.php, line 609
Class
- DOMTreeBuilder
- Create an HTML5 DOM tree from events.
Namespace
Masterminds\HTML5\ParserCode
public function processingInstruction($name, $data = null) {
// XXX: Ignore initial XML declaration, per the spec.
if ($this->insertMode === static::IM_INITIAL && 'xml' === strtolower($name)) {
return;
}
// Important: The processor may modify the current DOM tree however it sees fit.
if ($this->processor instanceof InstructionProcessor) {
$res = $this->processor
->process($this->current, $name, $data);
if (!empty($res)) {
$this->current = $res;
}
return;
}
// Otherwise, this is just a dumb PI element.
$node = $this->doc
->createProcessingInstruction($name, $data);
$this->current
->appendChild($node);
}