@samitouri / QOS-React / commits / 6cf77ef55e

Ensure validateDOMNesting catches nested body elements

Keyan Zhang committed Apr 9, 2016 at 15:49 UTC 6cf77ef55e4e610e91bc3b7e9b6e70784c52c4bd
2 files changed +3
src/renderers/dom/client/__tests__/validateDOMNesting-test.js
+2
@@ -83,5 +83,7 @@ describe('ReactContextValidator', function() {
83 expect(isTagStackValid(['table', 'tr'])).toBe(false);
84 expect(isTagStackValid(['div', 'ul', 'li', 'div', 'li'])).toBe(false);
85 expect(isTagStackValid(['div', 'html'])).toBe(false);
86 + expect(isTagStackValid(['body', 'body'])).toBe(false);
87 + expect(isTagStackValid(['svg', 'foreignObject', 'body', 'p'])).toBe(false);
88 });
89 });
src/renderers/dom/client/validateDOMNesting.js
+1
@@ -208,6 +208,7 @@ if (__DEV__) {
208 case 'rt':
209 return impliedEndTags.indexOf(parentTag) === -1;
210
211 + case 'body':
212 case 'caption':
213 case 'col':
214 case 'colgroup':