Skip to content

Commit 3b1a704

Browse files
committed
Merge pull request #99 from Masterminds/fix/98
Fixes #98: a DOM is allowed within noscript tags
2 parents 26edd5b + 432908f commit 3b1a704

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/HTML5/Elements.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Elements
2424
const KNOWN_ELEMENT = 1;
2525

2626
// From section 8.1.2: "script", "style"
27-
// From 8.2.5.4.7 ("in body" insertion mode): "noembed", "noscript"
27+
// From 8.2.5.4.7 ("in body" insertion mode): "noembed"
2828
// From 8.4 "style", "xmp", "iframe", "noembed", "noframes"
2929
/**
3030
* Indicates the contained text should be processed as raw text.
@@ -144,7 +144,7 @@ class Elements
144144
"meta" => 9, // NORMAL | VOID_TAG
145145
"meter" => 1,
146146
"nav" => 17, // NORMAL | AUTOCLOSE_P,
147-
"noscript" => 67, // NORMAL | TEXT_RAW | BLOCK_TAG
147+
"noscript" => 65, // NORMAL | BLOCK_TAG
148148
"object" => 1,
149149
"ol" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG
150150
"optgroup" => 1,

test/HTML5/Parser/DOMTreeBuilderTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function testDocumentWithATargetDocument()
100100
$this->assertSame($doc, $targetDom);
101101
$this->assertEquals('html', $doc->documentElement->tagName);
102102
}
103-
103+
104104
public function testDocumentFakeAttrAbsence()
105105
{
106106
$html = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><body>foo</body></html>";
@@ -495,6 +495,12 @@ public function testNoScript()
495495
$this->assertEmpty($this->errors);
496496
$noscript = $doc->getElementsByTagName('noscript')->item(0);
497497
$this->assertEquals('noscript', $noscript->tagName);
498+
499+
$html = '<!DOCTYPE html><html><body><noscript><p>No JS</p></noscript></body></html>';
500+
$doc = $this->parse($html);
501+
$this->assertEmpty($this->errors);
502+
$p = $doc->getElementsByTagName('p')->item(0);
503+
$this->assertEquals('p', $p->tagName);
498504
}
499505

500506
/**

0 commit comments

Comments
 (0)