dillon1000/react

Commit

Throw on Missing Elements

This changes React to throw when `ReactID.getNode()` fails to find a node. This method is used by two call sites:

 - Implements `ReactComponent#getDOMNode`. This method already throws if a component is not mounted, and //all mounted components should be able to find their rendered root nodes//.
 - Used by `ReactDOMIDOperations`. These call sites aleady assume that `getNode` returns a non-null. Currently, if the node is not found, this is the site that fatals (and the stack trace is much harder to debug).

The error message should make it //a lot// easier to debug unexpected DOM trees. In particular, this will help track down all the places where the browser inserts `<tbody>` unexpectedly.
Browse files
Changed paths5 files
First-parent comparison
M src/core/ReactComponent.js ModifiedM src/core/ReactID.js ModifiedM src/core/ReactInstanceHandles.js ModifiedM src/core/ReactMount.js ModifiedM src/core/__tests__/ReactInstanceHandles-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…