File tree 1 file changed +6
-3
lines changed 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -457,14 +457,17 @@ public function testText()
457
457
$ data = $ wrapper ->childNodes ->item (0 );
458
458
$ this ->assertEquals (XML_TEXT_NODE , $ data ->nodeType );
459
459
$ this ->assertEquals ('test ' , $ data ->data );
460
+ }
460
461
462
+ public function testTextBeforeHeadNotAllowed ()
463
+ {
461
464
// The DomTreeBuilder has special handling for text when in before head mode.
462
- $ html = '<!DOCTYPE html><html>
463
- Foo<head></head><body></body></html> ' ;
465
+ $ html = '<!DOCTYPE html><html>Foo<head></head><body></body></html> ' ;
464
466
$ doc = $ this ->parse ($ html );
465
- $ this ->assertEquals ('Line 0, Col 0: Unexpected text. Ignoring: Foo ' , $ this ->errors [0 ]);
467
+ $ this ->assertEquals ('Line 0, Col 0: Unexpected head tag outside of head context. ' , $ this ->errors [0 ]);
466
468
$ headElement = $ doc ->documentElement ->firstChild ;
467
469
$ this ->assertEquals ('head ' , $ headElement ->tagName );
470
+ $ this ->assertXmlStringEqualsXmlString ($ doc , '<html xmlns="http://www.w3.org/1999/xhtml"><head/><body>Foo<head/><body/></body></html> ' );
468
471
}
469
472
470
473
public function testParseErrors ()
You can’t perform that action at this time.
0 commit comments