-
Notifications
You must be signed in to change notification settings - Fork 173
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
Add support for HTML comments #84
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
@jviide can we possibly adjust this PR a bit to support other types of unclosed tags, ideally customizable by consumer?
(related issue #91 (comment)) That will be super-useful for consuming frameworks and should not add much size to the parser. import htm from 'htm'
// the dict of reserved single tags with (possibly) handlers?
htm.single = { '!--': true, '?xml': true, br: true, hr: true}
// the default is { '!--': true } |
@dy that would add quite a bit of size since currently the parser tags/tokens get inlined. In general, I don't want to do anything that takes |
Merged in the changes from the current master. The final size is 588 B (up from 563 B) for the regular build and 417 B (up from 394 B) for the mini build. |
This pull request adds support for HTML5-style comments (with relevant tests). Everything between comment delimiters
<!--
and-->
gets ignored during parsing. For example the the following template gets parsed ash("div", null)
:A deviation from the HTML5 standard is that the text between the delimiters can start with
>
and->
.The
.mjs.br
size grows from 540 to 564 bytes for the regular build. The mini version grows from 376 to 398 bytes.Closes #79.