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

Invalid HTML is not reported by Vue #9059

Closed
dimensi opened this issue Nov 12, 2018 · 3 comments
Closed

Invalid HTML is not reported by Vue #9059

dimensi opened this issue Nov 12, 2018 · 3 comments

Comments

@dimensi
Copy link

dimensi commented Nov 12, 2018

Version

2.5.16

Reproduction link

https://codesandbox.io/s/vj83wp3jz0

Steps to reproduce

  1. Write <p><div></div></p>
  2. Add wrong html markup into slots

What is expected?

Got readble error with explanations

What is actually happening?

Got unreadble errors.


In vue chat newbie write about problem with slots. I notice wrong html markup, div in p. But i think vue must not die with unreadble errors if he got wrong html markup in slot.

@dimensi dimensi changed the title Component with slots and wrong html markup kill Vue wrong html markup in scoped slots kill Vue with unreadble errors. Nov 12, 2018
@dimensi dimensi changed the title wrong html markup in scoped slots kill Vue with unreadble errors. Wrong html markup in scoped slots kill Vue with unreadble errors. Nov 12, 2018
@dimensi dimensi changed the title Wrong html markup in scoped slots kill Vue with unreadble errors. Wrong html markup in scoped slots kill Vue with unreadble errors Nov 12, 2018
@posva
Copy link
Member

posva commented Nov 12, 2018

As you can imagine, we cannot add every HTML rule to the html parser. In this scenario, it would require it to be handled by the template compiler and display an error in the terminal

@posva posva closed this as completed Nov 12, 2018
@posva posva changed the title Wrong html markup in scoped slots kill Vue with unreadble errors Invalid HTML is not reported by Vue Nov 12, 2018
@Justineo
Copy link
Member

Justineo commented Nov 13, 2018

Actually it's not only a compile time thing. You can generate wrongly structured VDOM nodes at runtime. If we are gonna warn about this, it would be quite expensive because we'll have to check the VDOM structure upon each update. I do think this is something nice to have, and I think it's possible to make some userland plugins to perform runtime validation (leveraging tools like ecomfe/html-nest-rule) with the updated hook.

@dimensi
Copy link
Author

dimensi commented Nov 13, 2018

@posva i notice react can handle errors like this. But if we can't, okay.

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

3 participants