mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Tweak validation message, add html support
The old message made no sense if you had a > div > a or similar. I'm clearly feeling sloppy today.
This commit is contained in:
@@ -668,7 +668,8 @@ describe('ReactDOMComponent', function() {
|
||||
|
||||
expect(console.error.calls.length).toBe(1);
|
||||
expect(console.error.calls[0].args[0]).toBe(
|
||||
'Warning: validateDOMNesting(...): <div> cannot contain a <tr> node.'
|
||||
'Warning: validateDOMNesting(...): <tr> cannot appear as a child of ' +
|
||||
'<div> in this context (div > div).'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -679,7 +680,8 @@ describe('ReactDOMComponent', function() {
|
||||
|
||||
expect(console.error.calls.length).toBe(1);
|
||||
expect(console.error.calls[0].args[0]).toBe(
|
||||
'Warning: validateDOMNesting(...): <p> cannot contain a <tr> node.'
|
||||
'Warning: validateDOMNesting(...): <tr> cannot appear as a child of ' +
|
||||
'<p> in this context (p).'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -694,9 +696,10 @@ describe('ReactDOMComponent', function() {
|
||||
|
||||
expect(console.error.calls.length).toBe(1);
|
||||
expect(console.error.calls[0].args[0]).toBe(
|
||||
'Warning: validateDOMNesting(...): <table> cannot contain a <tr> ' +
|
||||
'node. Add a <tbody> to your code to match the DOM tree generated by ' +
|
||||
'the browser. Check the render method of `Foo`.'
|
||||
'Warning: validateDOMNesting(...): <tr> cannot appear as a child of ' +
|
||||
'<table> in this context (div > table). Add a <tbody> to your code ' +
|
||||
'to match the DOM tree generated by the browser. Check the render ' +
|
||||
'method of `Foo`.'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -176,6 +176,10 @@ if (__DEV__) {
|
||||
tag === 'noscript' || tag === 'noframes' || tag === 'style' ||
|
||||
tag === 'script' || tag === 'template'
|
||||
);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
|
||||
case 'html':
|
||||
return tag === 'head' || tag === 'body';
|
||||
}
|
||||
|
||||
// Probably in the "in body" parsing mode, so we outlaw only tag combos
|
||||
@@ -292,9 +296,11 @@ if (__DEV__) {
|
||||
|
||||
warning(
|
||||
false,
|
||||
'validateDOMNesting(...): <%s> cannot contain a <%s> node.%s',
|
||||
parentTag,
|
||||
'validateDOMNesting(...): <%s> cannot appear as a child of <%s> ' +
|
||||
'in this context (%s).%s',
|
||||
childTag,
|
||||
parentTag,
|
||||
parentStack.join(' > '),
|
||||
info
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user