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

Validate nesting of DOM nodes #14

Open
Tracked by #76
aalin opened this issue Sep 29, 2022 · 0 comments · May be fixed by #76
Open
Tracked by #76

Validate nesting of DOM nodes #14

aalin opened this issue Sep 29, 2022 · 0 comments · May be fixed by #76
Labels
enhancement New feature or request

Comments

@aalin
Copy link
Contributor

aalin commented Sep 29, 2022

Browsers accept invalid HTML and rearranges things into valid HTML.

So:

<table>
  <tr></tr>
</table>

will turn into:

<table>
  <tbody>
    <tr></tr>
  </tbody>
</table>

This will make Mayu confused because there is a tbody where there should be a tr...

Something like this maybe:

https://github.com/facebook/react/blob/97d75c9c8bcddb0daed1ed062101c7f5e9b825f4/packages/react-dom-bindings/src/client/validateDOMNesting.js

This should be configurable so that it can be disabled in production mode.

Update: If #20 gets implemented with Nokogiri, then, I think that Nokogiri will make sure elements are wrapped correctly. The errors from Nokogiri could be logged, but the server side DOM will at least be valid, so that it will always be in sync with the browser DOM.

aalin added a commit that referenced this issue Sep 29, 2022
This is how React does it:
https://reactjs.org/docs/forms.html#the-select-tag

Related to #14 because it's doing some validation too.
@aalin aalin changed the title Validate nesting of DOM elements Validate nesting of DOM nodes Oct 29, 2022
@aalin aalin added the enhancement New feature or request label Nov 11, 2022
@aalin aalin linked a pull request Jun 21, 2024 that will close this issue
17 tasks
@aalin aalin linked a pull request Jun 22, 2024 that will close this issue
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant