refactor(parser): Highlight special close-implies-open logic#1047
Merged
fb55 merged 1 commit intofb55:masterfrom Dec 17, 2021
Merged
refactor(parser): Highlight special close-implies-open logic#1047fb55 merged 1 commit intofb55:masterfrom
fb55 merged 1 commit intofb55:masterfrom
Conversation
Only </p> and </br> close tags result in implied open tags: - [`p`](https://github.com/fb55/htmlparser2/blob/6445c32b05dc070049eeaaf201bfc123daca3d37/src/Parser.ts#L336) - [`br`](https://github.com/fb55/htmlparser2/blob/6445c32b05dc070049eeaaf201bfc123daca3d37/src/Parser.ts#L340) tags. This commit clarifies this in the existing comments. It also makes the special case nature of this more apparent by using the literal values 'p' and 'br' instead of the variable `name`, which is proven to have these values. This is less obfuscating.
6df0bb6 to
9b096c2
Compare
onclosetag logic for p and br
Contributor
Author
|
Question: is there a reason that only |
Owner
|
Hi @vassudanagunta, thanks for this PR! This logic was changed in #52, which includes some explanations. |
Pull Request Test Coverage Report for Build 1580382724
💛 - Coveralls |
Contributor
Author
|
Ok, cool, thanks. I'm actually looking at the same spec issue 52 refers to to figure out the proper behavior for something that i think htmlparser2 gets wrong... i'll share it with you as a WIP PR so that I can demonstrate with test cases and we can discuss whether you agree. |
Owner
|
If you don't want to go through the entire spec, one good place to look is parse5's parser implementation. |
Contributor
Author
|
I meant something else unrelated to this issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only
</p>and</br>close tags result in implied open tags:pbrThis commit clarifies this in the existing comments. It also
makes the special case nature of this more apparent by using
the literal values 'p' and 'br' instead of the variable
name,which is proven to have these values. This is less obfuscating.