Skip to content

Commit 75be670

Browse files
test(xml): give XML its own tokenizer and parser tests
The XML mode's cases move out of the HTML tests, and the tree's parse errors from the HTML tokenizer test into its parser test. HTML and XML tests together still read every line they read before, and one branch only EOF reaches is folded. Claude-Session: https://claude.ai/code/session_017TkBWTk3wcyUcJYDp5ZhaP
1 parent 0f322e6 commit 75be670

5 files changed

Lines changed: 1172 additions & 1146 deletions

File tree

‎lib/html/syntax-parser.js‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8298,10 +8298,9 @@ modes.inBody = (t) => {
82988298
if (t.type === TOKEN_DOCTYPE) return treeError("unexpected-doctype", t);
82998299
if (t.type === TOKEN_START_TAG) return startTagInBody(t);
83008300
if (t.type === TOKEN_END_TAG) return endTagInBody(t);
8301-
if (t.type === TOKEN_EOF) {
8302-
if (templateModes.length) return modes.inTemplate(t);
8303-
if (hasUnclosedElement()) treeError("expected-closing-tag-but-got-eof", t);
8304-
}
8301+
// The end of the input, the one kind of token left.
8302+
if (templateModes.length) return modes.inTemplate(t);
8303+
if (hasUnclosedElement()) treeError("expected-closing-tag-but-got-eof", t);
83058304
};
83068305

83078306
/**

0 commit comments

Comments
 (0)