Skip to content

Conversation

@fb55
Copy link
Collaborator

@fb55 fb55 commented Feb 11, 2022

See #403 for details.

The parser currently first checks the insertion mode, and then the token type. By inverting this (checking first the token type, then the insertion mode), we prepare the parser to accept the events from #404.

This change also allowed foreign content checks to be greatly simplified.

@fb55
Copy link
Collaborator Author

fb55 commented Feb 11, 2022

One thing I am currently unhappy about is the tokenizer.inForeignNode and currentNotInHTML naming inside of the parser.

  • currentNotInHTML indicates that the current node is not an element in the HTML namespace.
  • tokenizer.inForeignNode (fka. tokenizer.allowCDATA) indicates that the current node is not an element in the HTML namespace, and that it is not an integration point for either MathML or HTML. (See https://html.spec.whatwg.org/#tree-construction)

If someone can come up with better names, I'm am more than happy to take them.

Copy link
Collaborator

@wooorm wooorm left a comment

Choose a reason for hiding this comment

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

Isn’t this a deviation from how the spec is written? Seems like that’ll cause future problems.

@fb55
Copy link
Collaborator Author

fb55 commented Feb 13, 2022

Isn’t this a deviation from how the spec is written? Seems like that’ll cause future problems.

parse5 already has a split for specific token handlers that doesn't exist in the spec. The splitting point was moved up by a step, which shouldn't make it harder to map the spec to the code.

@fb55 fb55 merged commit 9d76f78 into inikulin:master Feb 27, 2022
@fb55 fb55 deleted the refactor/cbs branch February 27, 2022 07:36
jmbpwtw pushed a commit to jmbpwtw/parse5 that referenced this pull request Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants