MCPcopy Create free account
hub / github.com/Lucifier129/react-lite / isValid

Function isValid

examples/simple/react.js:10787–10798  ·  view source on GitHub ↗

* A node is "valid" if it is contained by a currently mounted container. * * This means that the node does not have to be contained by a document in * order to be considered valid. * * @param {?DOMElement} node The candidate DOM node. * @param {string} id The expected ID of the node. * @retur

(node, id)

Source from the content-addressed store, hash-verified

10785 * @return {boolean} Whether the node is contained by a mounted container.
10786 */
10787function isValid(node, id) {
10788 if (node) {
10789 !(internalGetID(node) === id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
10790
10791 var container = ReactMount.findReactContainerForID(id);
10792 if (container && containsNode(container, node)) {
10793 return true;
10794 }
10795 }
10796
10797 return false;
10798}
10799
10800/**
10801 * Causes the cache to forget about one React-specific ID.

Callers 4

getIDFunction · 0.85
getNodeFunction · 0.85
getNodeFromInstanceFunction · 0.85

Calls 3

internalGetIDFunction · 0.85
containsNodeFunction · 0.85
invariantFunction · 0.70

Tested by

no test coverage detected