10000 Fix two more bugs. · Nimbleworks/html5lib-php@e7e7133 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7e7133

Browse files
author
Edward Z. Yang ext:(%22)
committed
Fix two more bugs.
1 parent 6b6ea0b commit e7e7133

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

library/HTML5/TreeConstructer.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,11 @@ public function emitToken($token, $mode = null) {
437437
$this->mode = self::AFTER_HEAD;
438438

439439
// Slight logic inversion here to minimize duplication
440-
/* A start tag with the tag name "head" or an end tag except "html". */
440+
/* A start tag with the tag name "head". */
441+
/* An end tag whose tag name is not one of: "body", "html", "br" */
441442
} elseif(($token['type'] === HTML5_Tokenizer::STARTTAG && $token['name'] === 'head') ||
442-
($token['type'] === HTML5_Tokenizer::ENDTAG && $token['name'] !== 'html')) {
443+
($token['type'] === HTML5_Tokenizer::ENDTAG && $token['name'] !== 'html' &&
444+
$token['name'] !== 'body' && $token['name'] !== 'br')) {
443445
// Parse error. Ignore the token.
444446
$this->ignored = true;
445447

@@ -784,10 +786,10 @@ public function emitToken($token, $mode = null) {
784786
* tag with the same tag name as node had been seen, then
785787
* jump to the last step. */
786788
if(($token['name'] === 'li' && $node->tagName === 'li') ||
787-
($node->tagName === 'dd' || $node->tagName === 'dt')) { // limited conditional
789+
($token['name'] !== 'li' && ($node->tagName === 'dd' || $node->tagName === 'dt'))) { // limited conditional
788790
$this->emitToken(array(
789791
'type' => HTML5_Tokenizer::ENDTAG,
790-
'name' => $token['name'],
792+
'name' => $node->tagName,
791793
));
792794
break;
793795
}

0 commit comments

Comments
 (0)
0