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

<label> around an input field eats following elements #34

Closed
josephg opened this issue Jun 26, 2016 · 6 comments
Closed

<label> around an input field eats following elements #34

josephg opened this issue Jun 26, 2016 · 6 comments

Comments

@josephg
Copy link
Contributor

josephg commented Jun 26, 2016

I'm not sure what the problem is, but if I have an input field inside a label as recommended by mdn:

bel(`<div>
  <label> <input type="checkbox" checked> text </label>
  <a>outside</a>
</div>`).toString();

// ->
<div>
  <label> <input type="text" type="type" checkbox"="checkbox&quot;" />
    <a>outside</a>
  </label>
</div>

... The following elements somehow teleport inside the label.

[Edited: Added checked to the input tag, which is required to reproduce the bug.]

@jamesplease
Copy link

jamesplease commented Jun 26, 2016

Can you make a requirebin? This seems to work for me.

lol super pixely img:

image

@josephg
Copy link
Contributor Author

josephg commented Jun 26, 2016

Oops! I was a bit too keen at trimming down the test case. Requirebin only works in incognito windows for some reason for me, where I'm not logged in to github. (That or it takes 20+ seconds to start up, in which case I'm just not patient enough.)

Anyway:

image

var bel = require('bel');

var html = bel`<div>
  <label>
    <input type="checkbox" id="keep" checked>text
  </label>
  <a>Outside</a>
</div>`;

console.log('hello', html);

Cases:

  • <input type="checkbox" id="keep" checked>: buggy
  • <input type="checkbox" id="keep" checked=true>: buggy
  • <input type="checkbox" id="keep" checked="true">: ok
  • <input type="checkbox" id="keep" checked />: ok

@yoshuawuyts
Copy link
Member

Probably related to #28

@jamesplease
Copy link

Ah, oops, somehow the checked attr got removed when I was playing around in Requirebin, and I didn't notice.

Thanks for taking the time to make that Requirebin, even though it sounded pretty tedious to set up :P The two issues do seem likely to be related – thanks @yoshuawuyts !

@shama
Copy link
Member

shama commented Jun 28, 2016

I'll look into this again soon. That and <br/> doesn't work but <br /> does!

@goto-bus-stop
Copy link
Member

This appears to be fixed in the latest hyperx; probably by choojs/hyperx@d85b56b. thanks!

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

5 participants