MCPcopy Create free account
hub / github.com/reactjs/react-rails / findRootContainerNode

Function findRootContainerNode

lib/assets/react-source/development/react.js:7160–7178  ·  view source on GitHub ↗

* Find the deepest React component completely containing the root of the * passed-in instance (for use when entire React trees are nested within each * other). If React trees are not nested, returns null.

(inst)

Source from the content-addressed store, hash-verified

7158
7159
7160 function findRootContainerNode(inst) {
7161 if (inst.tag === HostRoot) {
7162 return inst.stateNode.containerInfo;
7163 } // TODO: It may be a good idea to cache this to prevent unnecessary DOM
7164 // traversal, but caching is difficult to do correctly without using a
7165 // mutation observer to listen for all DOM changes.
7166
7167
7168 while (inst.return) {
7169 inst = inst.return;
7170 }
7171
7172 if (inst.tag !== HostRoot) {
7173 // This can happen if we're in a detached tree.
7174 return null;
7175 }
7176
7177 return inst.stateNode.containerInfo;
7178 }
7179 /**
7180 * Allows registered plugins an opportunity to extract events from top-level
7181 * native browser events.

Callers 1

handleTopLevelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected