dillon1000/react

Commit

Validate only against problematic tag nesting

Turns out lots of people write invalid HTML all the time and no one, including your browser or React, cares. Most invalid HTML combinations don't cause magic reparented nodes; only some do. The HTML5 parsing spec (https://html.spec.whatwg.org/multipage/syntax.html) specifies which tag combinations cause strange parsing behavior. I did my best to encode the logic here. It's more lenient than before in some cases, but more strict in others (before we didn't look at the whole stack of tags; now we warn with deeply nested `p` or `form` or `a` tags).
Browse files
Changed paths5 files
First-parent comparison
A src/browser/__tests__/validateDOMNesting-test.js AddedM src/browser/ui/ReactDOMComponent.js ModifiedM src/browser/ui/ReactDOMTextComponent.js ModifiedM src/browser/ui/ReactMount.js ModifiedM src/browser/validateDOMNesting.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…