Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed tagName tokenizer such that finding EOF within tagName will r… #46

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/src/tokenizer.dart
Expand Up @@ -570,7 +570,8 @@ class HtmlTokenizer implements Iterator<Token> {
} else if (data == ">") {
emitCurrentToken();
} else if (data == EOF) {
_addToken(new ParseErrorToken("eof-in-tag-name"));
_addToken(new CharactersToken("<" + currentTagToken.name));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is not spec compliant. this should be an error, see: https://html.spec.whatwg.org/multipage/syntax.html#tag-name-state

stream.unget(data);
state = dataState;
} else if (data == "/") {
state = selfClosingStartTagState;
Expand Down
4 changes: 2 additions & 2 deletions test/data/tokenizer/test4.test
Expand Up @@ -303,11 +303,11 @@

{"description":"EOF in tag name state ",
"input":"<a",
"output":["ParseError"]},
"output":[["Character","<a"]]},

{"description":"EOF in tag name state",
"input":"<a",
"output":["ParseError"]},
"output":[["Character","<a"]]},

{"description":"EOF in before attribute name state",
"input":"<a ",
Expand Down
1 change: 1 addition & 0 deletions test/data/tree-construction/webkit01.dat
Expand Up @@ -34,6 +34,7 @@ Line: 1 Col: 4 Unexpected non-space characters. Expected DOCTYPE.
| <html>
| <head>
| <body>
| "<di"

#data
<div>Hello</div>
Expand Down