mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Merge pull request #5694 from spicyj/div-html-nesting
Make sure div > html nesting is considered invalid
This commit is contained in:
@@ -67,6 +67,7 @@ describe('ReactContextValidator', function() {
|
||||
expect(isTagStackValid(['div', 'a', 'object', 'a'])).toBe(true);
|
||||
expect(isTagStackValid(['div', 'p', 'button', 'p'])).toBe(true);
|
||||
expect(isTagStackValid(['p', 'svg', 'foreignObject', 'p'])).toBe(true);
|
||||
expect(isTagStackValid(['html', 'body', 'div'])).toBe(true);
|
||||
|
||||
// Invalid, but not changed by browser parsing so we allow them
|
||||
expect(isTagStackValid(['div', 'ul', 'ul', 'li'])).toBe(true);
|
||||
@@ -81,5 +82,6 @@ describe('ReactContextValidator', function() {
|
||||
expect(isTagStackValid(['p', 'p'])).toBe(false);
|
||||
expect(isTagStackValid(['table', 'tr'])).toBe(false);
|
||||
expect(isTagStackValid(['div', 'ul', 'li', 'div', 'li'])).toBe(false);
|
||||
expect(isTagStackValid(['div', 'html'])).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -186,6 +186,8 @@ if (__DEV__) {
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
|
||||
case 'html':
|
||||
return tag === 'head' || tag === 'body';
|
||||
case '#document':
|
||||
return tag === 'html';
|
||||
}
|
||||
|
||||
// Probably in the "in body" parsing mode, so we outlaw only tag combos
|
||||
@@ -212,6 +214,7 @@ if (__DEV__) {
|
||||
case 'colgroup':
|
||||
case 'frame':
|
||||
case 'head':
|
||||
case 'html':
|
||||
case 'tbody':
|
||||
case 'td':
|
||||
case 'tfoot':
|
||||
|
||||
Reference in New Issue
Block a user