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

Breaks When Using <br/> #38

Closed
FlorianWendelborn opened this issue Feb 1, 2017 · 3 comments
Closed

Breaks When Using <br/> #38

FlorianWendelborn opened this issue Feb 1, 2017 · 3 comments

Comments

@FlorianWendelborn
Copy link

FlorianWendelborn commented Feb 1, 2017

I tried to modify hyperapp's counter example. When inserting a line-break <br/> it broke. 🙁

Console

InvalidCharacterError (DOM Exception 5): The string contains invalid characters.

Minimal Repro

app({
    view: () => html`<div>a<br/>b</div>`
})

Meta

Corresponding issue on hyperapp's repo.
Related to #34.


Note that I do realize that <br> works. <br/> is more explicit though and as a React-user I'd like to keep this pattern.

@Ramblurr
Copy link

I also was caught by this bug.

@josephg
Copy link
Contributor

josephg commented Oct 3, 2017

Some notes:

  • Self-closing tags don't exist in the html spec.
  • Browsers do ignore the '/' and treat <br/> and <br> as synonyms
  • Hyperx works fine if you put in a space - <br />
  • It should be easy to change the parser to support this. Its probably a ~2 line change to stop parsing the tag name when the parser sees a '/' character. Make a unit test, fix the code and submit a PR.
  • For now, the workaround is to write <br />

@yoshuawuyts
Copy link
Member

A PR to support <br/> would be very welcome!

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

4 participants