Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Support HTML5 void elements #171
Comments
|
@dy ah interesting, optional closing elements are not something I'm after, is that 20% performance difference only caused by supporting void elements? Maybe it can be given as an option to support since 108 bytes more is not that much, the performance doesn't matter to me since I plan to use 'babel-plugin-htm'. |
Yes - each opening tag in markup should be checked against list of possible self-closing matches: |
|
you can use this (preprocessing) hack:
|
|
@cztomsik but how would you use it with templates |
|
I didn't need that (I'm using htm as temporary html parser so I'm just calling
It's ugly but it seems to work (and the regex had one bug) |
|
FWIW one of the reasons I don't think we're likely to consider this is because there are a lot of other HTML features that are unsupported in HTM. Adding a feature like void elements is net negative for performance, but it increases the likelihood of folks thinking HTM is an HTML parser. This assumption breaks down pretty quickly - attribute names are case-sensitive, whitespace is trimmed, etc. HTM is also most often used with Virtual DOM libraries, which further diverge from HTML since they tend to adopt HTML's property semantics for "props" rather than the string-only semantics of HTML attributes. We've actually had cases in Preact where folks using HTM have run into issues using namespaced attributes. VDOM doesn't have those, and they're only "supported" in HTM because it's faster and smaller to pass-through namespaces than it would be to prevent their usage. That all said, I do think it would be interesting for someone to resurrect the |
|
Thank you for the reply @developit, much appreciated. I understand the decision. I might publish a Will close, ofc. discussion is still possible. |
Of course it's not, I'm using it only temporarily BTW: @developit do you know about some small (well-formed is enough, speed is not an issue) HTML parsers? |
|
In case if you need htm-compatible API, have a look at xhtm
https://github.com/spectjs/xhtm
…On Tue, Sep 22, 2020 at 5:31 AM Kamil Tomšík ***@***.***> wrote:
of folks thinking HTM is an HTML parser.
Of course it's not, I'm using it only temporarily
BTW: @developit <https://github.com/developit> do you know about some
small (well-formed is enough, speed is not an issue) HTML parsers?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#171 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACJIIZT4LL7I4WPU44A5B3SHBVGFANCNFSM4NZERNKA>
.
|

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

It would be great to be able to write standard HTML5 without needing to close tags like in JSX, which is just another small thing to learn for developers.
E.g: an image tag normally works but doesn't in HTM:
<img src="hi.png>.