Skip to content

Validate nesting of DOM nodes #14

@aalin

Description

@aalin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions