MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / _populateIdMapWithTree

Function _populateIdMapWithTree

www/js/_hyperscript.js:3732–3747  ·  view source on GitHub ↗
(idMap, persistentIds, root, elements)

Source from the content-addressed store, hash-verified

3730 return persistentIds;
3731 }
3732 function _populateIdMapWithTree(idMap, persistentIds, root, elements) {
3733 for (var elt of elements) {
3734 if (persistentIds.has(elt.id)) {
3735 var current = elt;
3736 while (current && current !== root) {
3737 var idSet = idMap.get(current);
3738 if (idSet == null) {
3739 idSet = /* @__PURE__ */ new Set();
3740 idMap.set(current, idSet);
3741 }
3742 idSet.add(elt.id);
3743 current = current.parentElement;
3744 }
3745 }
3746 }
3747 }
3748 function _queryEltAndDescendants(elt, selector) {
3749 var results = [...elt.querySelectorAll?.(selector) ?? []];
3750 if (elt.matches?.(selector)) results.unshift(elt);

Callers 1

_createIdMapsFunction · 0.70

Calls 2

getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected