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

Function _populateIdMapWithTree

tools/common/_hyperscript.iife.js:3572–3587  ·  view source on GitHub ↗
(idMap, persistentIds, root, elements)

Source from the content-addressed store, hash-verified

3570 return persistentIds;
3571 }
3572 function _populateIdMapWithTree(idMap, persistentIds, root, elements) {
3573 for (var elt of elements) {
3574 if (persistentIds.has(elt.id)) {
3575 var current = elt;
3576 while (current && current !== root) {
3577 var idSet = idMap.get(current);
3578 if (idSet == null) {
3579 idSet = /* @__PURE__ */ new Set();
3580 idMap.set(current, idSet);
3581 }
3582 idSet.add(elt.id);
3583 current = current.parentElement;
3584 }
3585 }
3586 }
3587 }
3588 function _queryEltAndDescendants(elt, selector) {
3589 var results = [...elt.querySelectorAll?.(selector) ?? []];
3590 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