diff --git a/lib/Parser/Tokenizer.php b/lib/Parser/Tokenizer.php index e7f2828..0a65f4b 100644 --- a/lib/Parser/Tokenizer.php +++ b/lib/Parser/Tokenizer.php @@ -276,7 +276,7 @@ public function tokenize(): \Generator { // DEVIATION: Character reference consumption implemented as a function $outChar = $this->switchToCharacterReferenceState(self::DATA_STATE); if (strspn($outChar, Data::WHITESPACE)) { - yield new WhitespaceToken($outChar); // a character reference is either all whitespace is no whitespace + yield new WhitespaceToken($outChar); // a character reference is either all whitespace or is not whitespace } else { yield new CharacterToken($outChar); } diff --git a/lib/Parser/TreeConstructor.php b/lib/Parser/TreeConstructor.php index 55926d2..556b24d 100644 --- a/lib/Parser/TreeConstructor.php +++ b/lib/Parser/TreeConstructor.php @@ -1076,7 +1076,7 @@ public function constructTree(): void { # 2. Generate implied end tags. $this->stack->generateImpliedEndTags(); # 3. If the current node is not a form element, then this is a parse error. - if (!$this->stack->currentNodeName !== 'form') { + if ($this->stack->currentNodeName !== 'form') { $this->error(ParseError::UNEXPECTED_END_TAG, $token->name); } # 4. Pop elements from the stack of open elements until a form element has been @@ -2036,8 +2036,8 @@ public function constructTree(): void { // mode as it may have been turned on in a previous evluation // of this mode $this->fosterParenting = false; - # A character token, if the current node is table, tbody, tfoot, thead, or tr element - if ($token instanceof CharacterToken && in_array($this->stack->currentNodeName, ["table", "tbody", "tfoot", "thead", "tr"])) { + # A character token, if the current node is table, tbody, template, tfoot, thead, or tr element + if ($token instanceof CharacterToken && in_array($this->stack->currentNodeName, ["table", "tbody", "template", "tfoot", "thead", "tr"])) { # Let the pending table character tokens be an empty list of tokens. $this->pendingTableCharacterTokens = []; # Let the original insertion mode be the current insertion mode. diff --git a/tests/cases/TestTokenizer.php b/tests/cases/TestTokenizer.php index 90a3a70..4f4d5e3 100644 --- a/tests/cases/TestTokenizer.php +++ b/tests/cases/TestTokenizer.php @@ -235,32 +235,6 @@ protected function patchTest(&$test): void { case [" positions in some tests don't make sense - // https://github.com/html5lib/html5lib-tests/issues/125 - case ["", ["CDATA section state"]]: - // there is no position 2 - $test['errors'][0]['col']--; - break; - case ["\u{A}", ["CDATA section state"]]: - // the line break is, for some reason, not counted in the test - $test['errors'][0]['line']++; - $test['errors'][0]['col'] = 1; - break; - case ["