Test additions to expose/clarify perviously uncovered distinctions between "self closing tags" and void elements#1023
Closed
vassudanagunta wants to merge 1 commit intofb55:masterfrom
Closed
Conversation
…havior. - distinction between "self closing tags" and "void elements" - The meaning and intent of the `recognizeSelfClosing` option. - `Parser.ts` special logic for `<br>` vs other void elements.
5eb43bc to
84a4dd1
Compare
Contributor
Author
|
I will be resubmitting this with some mods, and from another branch than |
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.
This PR is first a forum for clarification, using test code for demonstration. Whether or not all or part of the test code changes should be accepted, modified or refactored depends on the outcome of this clarification.
The issue covered are:
distinction between "self closing tags" and "void elements"
The parser makes this distinction implicitly. I was able to piece this together from comments made in previous Issues/Pull Requests (where such a distinction is asserted) many years ago, from the code, and from the existence of the
recognizeSelfClosingoption. But there is no documentation on this distinction, even though void elements employ self closing tags. Either these terms should be synonymous or void elements is a subset of self closing tags.It's unclear whether this distinction makes sense. Or whether it makes sense that in HTML mode the self-closing
/>tag pattern is ignored and anonclosetagevent is generated later in the event stream no where near the actual self-closing tag.The meaning and intent of the
recognizeSelfClosingoption.This option was introduced in Fix existing and add new options #74 but without any tests nor any documentation.
Some documentation has been added since, but the distinction between "self closing tags" and "void elements" is still unclear, as is the real meaning of
recognizeSelfClosing.Parser.tshas special logic for<br>vs other void elements.But it's hard to figure out what the effective difference is.
The lack of tests covering/documenting the above.
The following test changes were made. All the tests PASS, so actual behavior is demonstrated. Questions raised are flagged with 🌶.
07-self-closing.jsonhas extended input:Both "self-closing tags" and "void elements" to expose behavioral differences. Compare the different results for
<hr />(void element) and<break />(self-closing tag).The addition of
<br />to expose any different treatment or lack thereof.A void element with attributes to add coverage of that scenario.
Seems a-ok.
07b-self-closing.jsonwas added. It has the exact same input as07-self-closing.json, but the Parser'srecognizeSelfClosingis set to true.35-non-br-void-close-tag.jsonhas extended input:<br>was added to show whether<br>in fact has different treatment as the name of the test implies.Happy to make any changes or refactors to these tests.