dillon1000/react

Commit

Make ReactMount.findComponentRoot breadth-first & non-recursive.

This function needs to be as fast as possible for those cases when
`ReactID.getNode` can't rely on the `nodeCache`.

Breadth-first search prevents us from diving too deeply down the wrong
branches when the sought-after node can be found at a shallower level.

The queue required for breadth-first search is implemented by a single
array indexed by `childIndex`. To save space, only the `.firstChild` nodes
are stored, and we use `.nextSibling` to iterate over the other siblings
in a `while` loop.
Browse files
Changed paths1 file
First-parent comparison
M src/core/ReactInstanceHandles.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…