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

Bel generates weird output with void html elements and unquoted attributes #94

Closed
josephg opened this issue Oct 3, 2017 · 6 comments
Closed

Comments

@josephg
Copy link
Contributor

josephg commented Oct 3, 2017

In the HTML spec, some elements are void and don't have closing tags:

Void elements
area, base, br, col, embed, hr, img, input, keygen, link, menuitem, meta, param, source, track, wbr

But in bel, they cause weird problems:

const bel = require('bel')
const element = bel`<span><input type=checkbox>some content</span>`
console.log(element.outerHTML)

It should be valid, but for some reason the content gets dropped from the output. It generates:

<span><input type="checkbox"></span>

Weirdly if I put quotes around the attribute (<input type="checkbox">) then it works. It also works if I put in a spurious /> - ie, <input type=checkbox />

@yoshuawuyts
Copy link
Member

yoshuawuyts commented Oct 3, 2017 via email

@josephg
Copy link
Contributor Author

josephg commented Oct 3, 2017

It looks like its actually a bug in hyperx and I've filed an issue there - choojs/hyperx#55

@josephg
Copy link
Contributor Author

josephg commented Oct 3, 2017

I'll see if I can find it and make a PR. Its too annoying.

@josephg
Copy link
Contributor Author

josephg commented Oct 3, 2017

Should be fixed by choojs/hyperx#56

@yoshuawuyts
Copy link
Member

hyperx@2.3.1 landed which should close the self-closing tags; not sure if this also fixes the unquoted string situation?

@josephg
Copy link
Contributor Author

josephg commented Nov 22, 2017

Oh yeah, I should have closed this ages ago. Thanks!

@josephg josephg closed this as completed Nov 22, 2017
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