dillon1000/react
Commit
Browse files 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.
Changed paths1 file
First-parent comparisonsrc/core/ReactInstanceHandles.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…