Skip to content
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

HEEx doesn't raise No space between attributes error #3528

Open
bcardarella opened this issue Nov 26, 2024 · 6 comments
Open

HEEx doesn't raise No space between attributes error #3528

bcardarella opened this issue Nov 26, 2024 · 6 comments

Comments

@bcardarella
Copy link
Contributor

bcardarella commented Nov 26, 2024

This works just fine:

~H"""
   <div style=""id="123"/>
"""

It will render as :

<div style="" id="123"/>

but the original template is invalid and shouldn't compile.

@josevalim
Copy link
Member

Although not ambiguous here, I understand why HTML does it. We could error but perhaps it makes more sense to warn, given the formatter will automatically fix it for you anyway, and that would not be possible if erroring.

@bcardarella
Copy link
Contributor Author

Now that LV is 1.0 I agree that this should not error. Considering it compiles anyway I didn't know if it was worth pursuing or not but figured I'd bring attention to it.

@bcardarella
Copy link
Contributor Author

bcardarella commented Dec 4, 2024

And Floki parses this syntax just fine without warning, which means that Mochi parses just fine. I think I'll close this as a non-issue.

I will have to account for this in LVN's template parser as we are erroring on it.

@josevalim josevalim reopened this Dec 4, 2024
@josevalim
Copy link
Member

Let's keep it open because I think warning is better. We don't want to have someone thinking this is fine and then emitting some hand written HTML somehow with this bug :)

@josevalim
Copy link
Member

FWIW, browsers parse it as multiple attributes too, but they are also historically known to be very lenient.

@bcardarella
Copy link
Contributor Author

yeah I sent it through the W3C validator which will be less forgiving

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants