You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the docs (https://herb-tools.dev/specification/html), it refers to <img /> and <div /> as self-closing tags. Except in HTML5 (the current standard), there is no such thing. It's a carry-over from the XHTML days, and it doesn't work as people expect.
So I highly recommend that Herb throw warnings (maybe even errors) and link to the above developer docs when any "self-closing" tags are encountered. This would help the Rails community write more compliant HTML code.
The text was updated successfully, but these errors were encountered:
Yeah I agree! This is a good idea. Thanks for opening this issue @KieranP!
I still haven't figured out 100% where this logic should go. Like, should this be as part of the parser directly or should this should be a lint-rule in the linter itself.
I guess what we could do for now, until we have the linter, is to add this logic to the parser itself, and then later once we have the linter, move the rule over.
In the docs (https://herb-tools.dev/specification/html), it refers to
<img />
and<div />
as self-closing tags. Except in HTML5 (the current standard), there is no such thing. It's a carry-over from the XHTML days, and it doesn't work as people expect.Browsers interpret
<div />Hello
as<div>Hello</div>
,<script />Hello
as<script>Hello</script>
, etc, leading to a lot of issues. More on that here: https://developer.mozilla.org/en-US/docs/Glossary/Void_element#self-closing_tagsSo I highly recommend that Herb throw warnings (maybe even errors) and link to the above developer docs when any "self-closing" tags are encountered. This would help the Rails community write more compliant HTML code.
The text was updated successfully, but these errors were encountered: