Skip to content

Commit

Permalink
Ensure validateDOMNesting catches nested body elements
Browse files Browse the repository at this point in the history
  • Loading branch information
keyz committed Apr 9, 2016
1 parent 6c11bb6 commit 85b503e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/renderers/dom/client/__tests__/validateDOMNesting-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,8 @@ describe('ReactContextValidator', function() {
expect(isTagStackValid(['table', 'tr'])).toBe(false);
expect(isTagStackValid(['div', 'ul', 'li', 'div', 'li'])).toBe(false);
expect(isTagStackValid(['div', 'html'])).toBe(false);

expect(isTagStackValid(['body', 'body'])).toBe(false);
expect(isTagStackValid(['svg', 'foreignObject', 'body', 'p'])).toBe(false);
});
});
2 changes: 2 additions & 0 deletions src/renderers/dom/client/validateDOMNesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ if (__DEV__) {
case 'th':
case 'thead':
case 'tr':

case 'body':
// These tags are only valid with a few parents that have special child
// parsing rules -- if we're down here, then none of those matched and
// so we allow it only if we don't know what the parent is, as all other
Expand Down

0 comments on commit 85b503e

Please sign in to comment.