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
HTMLEngine produces invalid HTML for self-closing tags #1596
Comments
I wasn't aware react did self-closing for any existing HTML. Our current approach only self-closes function components, not HTML tags. I'm willing to be convinced but I'm unsure how I feel about stuff like |
I agree we need to either raise or make it work. It seems a bit weird to allow HTML that is not really HTML on regular HTML nodes. |
I feel fine about accepting
It make it easier for people to copy/paste code from XHTML or JSX based templates. In case we want to "impose" a specific style as the default later, I don't think it's up to the tokenizer/parser to do that. This could/should be done by the formatter instead. |
@msaraiva sounds good. Is this something you have bandwidth to contribute? |
Sure thing! |
Amazing, thanks @msaraiva |
Environment
Actual behavior
When I have a tag like
<div />
(with attributes, but doesn't matter here), the browser doesn't close the div tag. This causes elements to get put as children of the div, even though they are not defined as children.Expected behavior
A self-closing HTML tag should either raise (invalid HTML) or close via the correct tag. So
<div />
should turn into<div></div>
.If developers are expecting heex to feel like JSX (for better or worse), then the tag should become properly closed and not raised.
The text was updated successfully, but these errors were encountered: