Tram-One / tram-one

🚋 Legacy View Framework For Vanilla Javascript
http://tram-one.io/
MIT License
36 stars 8 forks source link

hr tag needs to be self closing when adding to the DOM #162

Closed chtinahow closed 2 years ago

chtinahow commented 3 years ago

Summary

The current implementation for the hr tag states that the tag itself doesn't need to be self closing, however, in practice with tram-one, it needs to be self closing into order to work. e.g. a piece of code that looks like:

<h2>Round 1</h2>
<hr>

renders as image

JRJurman commented 2 years ago

In order to trim down the total bundle size (and avoid having to maintain a list of self-closing tags), we removed the list of hard-coded self-closing tags in hyperx.

See https://github.com/Tram-One/hyperx/commit/3791c9eab41d5a18c33fbc0a72493a230fb32674#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346L267-L282

I'm not sure in what way, but this probably warrants more documentation. Potentially adjacent to a "Cheat Sheet", we should have a "Gotchas" page (https://github.com/Tram-One/tram-one.github.io/issues/29)

JRJurman commented 2 years ago

(we could also try to read forward and determine if there is no closing version of this tag, to make it self-closing, but that would be significantly harder to build).