More actionable error message for <tbody> and nested <p>

This bites people all of the time. Until we have a better solution, let's just make the error message more actionable (most people don't know how the DOM
gets unexpectedly mutated).
This commit is contained in:
Pete Hunt
2014-03-16 22:01:34 -07:00
committed by Paul O’Shannessy
parent 9b427a322f
commit 04f9887f0e
2 changed files with 8 additions and 4 deletions
+4 -2
View File
@@ -618,8 +618,10 @@ var ReactMount = {
invariant(
false,
'findComponentRoot(..., %s): Unable to find element. This probably ' +
'means the DOM was unexpectedly mutated (e.g., by the browser). ' +
'Try inspecting the child nodes of the element with React ID `%s`.',
'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
'usually due to forgetting a <tbody> when using tables or nesting <p> ' +
'or <a> tags. Try inspecting the child nodes of the element with React ' +
'ID `%s`.',
targetID,
ReactMount.getID(ancestorNode)
);
@@ -146,8 +146,10 @@ describe('ReactInstanceHandles', function() {
}).toThrow(
'Invariant Violation: findComponentRoot(..., .0.1:0:junk): ' +
'Unable to find element. This probably means the DOM was ' +
'unexpectedly mutated (e.g., by the browser). Try inspecting the ' +
'child nodes of the element with React ID `.0`.'
'unexpectedly mutated (e.g., by the browser), usually due to ' +
'forgetting a <tbody> when using tables or nesting <p> or <a> ' +
'tags. Try inspecting the child nodes of the element with React ' +
'ID `.0`.'
);
});
});