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

Function getID

examples/simple/react.js:10705–10721  ·  view source on GitHub ↗

* Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form * element can return its control whose name or ID equals ATTR_NAME. All * DOM nodes support `getAttributeNode` but this can also get called on * other objects so just return '' if we're given something other than a * DOM no

(node)

Source from the content-addressed store, hash-verified

10703 * @return {string} ID of the supplied `domNode`.
10704 */
10705function getID(node) {
10706 var id = internalGetID(node);
10707 if (id) {
10708 if (nodeCache.hasOwnProperty(id)) {
10709 var cached = nodeCache[id];
10710 if (cached !== node) {
10711 !!isValid(cached, id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
10712
10713 nodeCache[id] = node;
10714 }
10715 } else {
10716 nodeCache[id] = node;
10717 }
10718 }
10719
10720 return id;
10721}
10722
10723function internalGetID(node) {
10724 // If node is something like a window, document, or text node, none of

Callers

nothing calls this directly

Calls 3

internalGetIDFunction · 0.85
isValidFunction · 0.85
invariantFunction · 0.70

Tested by

no test coverage detected