public function DOMTreeBuilder::processingInstruction in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php \Masterminds\HTML5\Parser\DOMTreeBuilder::processingInstruction()
This is a holdover from the XML spec.
While user agents don't get PIs, server-side does.
Parameters
string $name: The name of the processor (e.g. 'php').
string $data: The unparsed data.
Overrides EventHandler::processingInstruction
File
- vendor/
masterminds/ html5/ src/ HTML5/ Parser/ DOMTreeBuilder.php, line 589
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 (isset($this->processor)) {
$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);
}