Skip to content

Commit

Permalink
Handle error case where tag name starts with a digit
Browse files Browse the repository at this point in the history
  • Loading branch information
aaralh committed Dec 3, 2023
1 parent 904698a commit 5631f8f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions web/html/parser/HTMLTokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ def handle_tag_open(self) -> None:
elif self.__current_input_char.isalpha():
self.__current_token = cast(HTMLTag, self.__create_new_token(HTMLToken.TokenType.StartTag))
self.__reconsume_in(self.State.TagName)
else:
self.__current_token = cast(HTMLCommentOrCharacter, self.__create_new_token(HTMLToken.TokenType.Character))
self.__current_token.data = "<"
self.__emit_current_token()
self.__reconsume_in(self.State.Data)

def handle_end_tag_open(self) -> None:
self.__current_token = self.__create_new_token(HTMLToken.TokenType.EndTag)
Expand Down

0 comments on commit 5631f8f

Please sign in to comment.