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

Function _populateIdMapWithTree

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

Source from the content-addressed store, hash-verified

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