MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / _populateIdMapWithTree

Function _populateIdMapWithTree

www/js/_hyperscript-max.js:3731–3746  ·  view source on GitHub ↗
(idMap, persistentIds, root, elements)

Source from the content-addressed store, hash-verified

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