summaryrefslogtreecommitdiff
path: root/test/HTML5/Parser
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-08-07 11:57:33 -0400
committerMatt Farina <[email protected]>2013-08-07 11:57:33 -0400
commit65a11b73a06fcf3ce21db2298d9c460bcd286b66 (patch)
tree0e002119a15259f7ebcfbfa3ec7524e131f165ef /test/HTML5/Parser
parent2efd0c6052bf1492d3953d442c46e5ab9e45888a (diff)
#11: Updating the text handling for parsing when in before head mode. Now passing the ignored string characters through to the DOM and giving a parse error on other strings. Since this DOM is not used to render for display and it may be turned back into html it is useful to preserve these characters.
Diffstat (limited to 'test/HTML5/Parser')
-rw-r--r--test/HTML5/Parser/DOMTreeBuilderTest.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/HTML5/Parser/DOMTreeBuilderTest.php b/test/HTML5/Parser/DOMTreeBuilderTest.php
index c27b7f3..a6c6a9c 100644
--- a/test/HTML5/Parser/DOMTreeBuilderTest.php
+++ b/test/HTML5/Parser/DOMTreeBuilderTest.php
@@ -194,6 +194,14 @@ class DOMTreeBuilderTest extends \HTML5\Tests\TestCase {
$data = $wrapper->childNodes->item(0);
$this->assertEquals(XML_TEXT_NODE, $data->nodeType);
$this->assertEquals('test', $data->data);
+
+ // The DomTreeBuilder has special handling for text when in before head mode.
+ $html = "<!DOCTYPE html><html>
+ Foo<head></head><body></body></html>";
+ $doc = $this->parse($html);
+ $this->assertEquals('Line 0, Col 0: Unexpected text. Ignoring: Foo', $doc->errors[0]);
+ $whiteSpace = $doc->documentElement->firstChild;
+ $this->assertEquals("\n ", $whiteSpace->data);
}
public function testParseErrors() {