MCPcopy Create free account
hub / github.com/caseywebdev/react-list / getHydratableHoistableCache

Function getHydratableHoistableCache

docs/index.js:17586–17615  ·  view source on GitHub ↗
(type, keyAttribute, ownerDocument)

Source from the content-addressed store, hash-verified

17584}
17585var tagCaches = null;
17586function getHydratableHoistableCache(type, keyAttribute, ownerDocument) {
17587 if (null === tagCaches) {
17588 var cache = new Map();
17589 var caches = (tagCaches = new Map());
17590 caches.set(ownerDocument, cache);
17591 } else
17592 (caches = tagCaches),
17593 (cache = caches.get(ownerDocument)),
17594 cache || ((cache = new Map()), caches.set(ownerDocument, cache));
17595 if (cache.has(type)) return cache;
17596 cache.set(type, null);
17597 ownerDocument = ownerDocument.getElementsByTagName(type);
17598 for (caches = 0; caches < ownerDocument.length; caches++) {
17599 var node = ownerDocument[caches];
17600 if (
17601 !(
17602 node[internalHoistableMarker] ||
17603 node[internalInstanceKey] ||
17604 ("link" === type && "stylesheet" === node.getAttribute("rel"))
17605 ) &&
17606 "http://www.w3.org/2000/svg" !== node.namespaceURI
17607 ) {
17608 var nodeKey = node.getAttribute(keyAttribute) || "";
17609 nodeKey = type + nodeKey;
17610 var existing = cache.get(nodeKey);
17611 existing ? existing.push(node) : cache.set(nodeKey, [node]);
17612 }
17613 }
17614 return cache;
17615}
17616function mountHoistable(hoistableRoot, type, instance) {
17617 hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot;
17618 hoistableRoot.head.insertBefore(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…