-
Notifications
You must be signed in to change notification settings - Fork 48
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
Hyperx does not handle void elements + unquoted attributes correctly #55
Comments
seems that change breaks something but I don't really know what neither how... |
@yann300 uh oh; that's no good. Could you perhaps PR a test for it? We should fix this ASAP |
Uuh what? It looks like travis is trying to test hyperx using ruby configuration: https://travis-ci.org/choojs/hyperx/jobs/282733862/config But also @yann300 I'm not going to make a PR against your project, but I just spent some time looking into it. The problem is this line: <input type="text" class=${css.filter} onkeyup=${filter}></div> The DOM here is supposed to be balanced. You're closing a supposedly void element (input) with This brings up another issue that I really wish hyper addressed - I've seen things like this in the wild way too often with choo. The ergonomics of fixing issues like this is terrible:
At least in my previous job, it'd have been really convenient for hyperx to have a strict mode. |
Good catch. I kinda wish we had better ergonomics pointing out errors like these – for people whose code now suddenly broke, I can imagine it would feel rather frustrating that their code no longer works, even if it was never supposed to run in the first place. @josephg if you have any ideas how to improve this, help would be very welcome! @yann300 sorry your code broke; I hope it'll not be too much of a hassle to fix the newly pointed out errors and get things running again! |
No - sorry! We could wrap parsing in a try/catch which would re-parse using the old code if parsing failed with the new option. But thats awful. Sorry :/ I hope not too many people are affected. i suspect most people would have used |
) * Fixed issue #55 undefined attribute values are converted to strings * ignore attribute if injected value is null or undefined
In the HTML spec, some elements are
void
and don't have closing tags:But in hyperx, when combined with unquoted attributes they cause weird problems:
This should generate a span with 2 children (an input element and 'some content'). Instead, it tries to place the content inside the input element.
If I put quotes around the attribute (
<input type="checkbox">
) or put a useless space before the close of the tag>
then it works:One workaround is to always add quotes, but thats not possible when the last attribute is an event handler, eg this breaks:
And the event handler doesn't work if its quoted.
The text was updated successfully, but these errors were encountered: