* Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding * DOM node.
(inst)
| 7408 | * DOM node. |
| 7409 | */ |
| 7410 | function getNodeFromInstance(inst) { |
| 7411 | // Without this first invariant, passing a non-DOM-component triggers the next |
| 7412 | // invariant for a missing parent, which is super confusing. |
| 7413 | !(inst._nativeNode !== undefined) ? "development" !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0; |
| 7414 | |
| 7415 | if (inst._nativeNode) { |
| 7416 | return inst._nativeNode; |
| 7417 | } |
| 7418 | |
| 7419 | // Walk up the tree until we find an ancestor whose DOM node we have cached. |
| 7420 | var parents = []; |
| 7421 | while (!inst._nativeNode) { |
| 7422 | parents.push(inst); |
| 7423 | !inst._nativeParent ? "development" !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : invariant(false) : void 0; |
| 7424 | inst = inst._nativeParent; |
| 7425 | } |
| 7426 | |
| 7427 | // Now parents contains each ancestor that does *not* have a cached native |
| 7428 | // node, and `inst` is the deepest ancestor that does. |
| 7429 | for (; parents.length; inst = parents.pop()) { |
| 7430 | precacheChildNodes(inst, inst._nativeNode); |
| 7431 | } |
| 7432 | |
| 7433 | return inst._nativeNode; |
| 7434 | } |
| 7435 | |
| 7436 | var ReactDOMComponentTree = { |
| 7437 | getClosestInstanceFromNode: getClosestInstanceFromNode, |
nothing calls this directly
no test coverage detected
searching dependent graphs…