diff options
author | Matt Butcher <[email protected]> | 2013-05-01 14:55:36 -0500 |
---|---|---|
committer | Matt Butcher <[email protected]> | 2013-05-01 14:55:36 -0500 |
commit | c5099f50fd68f26741d061cff5a3ccd086e00cfe (patch) | |
tree | 54b5163ef9579f7eca00ea431a12d58d92c6f807 /src/HTML5 | |
parent | bae705bdea510398f654ffbfc25454b75c6e8a65 (diff) |
Fixes for PI tests.
Diffstat (limited to 'src/HTML5')
-rw-r--r-- | src/HTML5/Parser/DOMTreeBuilder.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/HTML5/Parser/DOMTreeBuilder.php b/src/HTML5/Parser/DOMTreeBuilder.php index 4e2669c..686effc 100644 --- a/src/HTML5/Parser/DOMTreeBuilder.php +++ b/src/HTML5/Parser/DOMTreeBuilder.php @@ -266,6 +266,11 @@ class DOMTreeBuilder implements EventHandler { } public function processingInstruction($name, $data = NULL) { + // XXX: Ignore initial XML declaration, per the spec. + if ($this->insertMode == self::IM_INITIAL && 'xml' == strtolower($name)) { + return; + } + // Important: The processor may modify the current DOM tree however // it sees fit. if (isset($this->processor)) { @@ -273,7 +278,13 @@ class DOMTreeBuilder implements EventHandler { 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); } // ========================================================================== |