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

Function _populateIdMapWithTree

src/core/runtime/morph.js:242–254  ·  view source on GitHub ↗
(idMap, persistentIds, root, elements)

Source from the content-addressed store, hash-verified

240}
241
242function _populateIdMapWithTree(idMap, persistentIds, root, elements) {
243 for (var elt of elements) {
244 if (persistentIds.has(elt.id)) {
245 var current = elt;
246 while (current && current !== root) {
247 var idSet = idMap.get(current);
248 if (idSet == null) { idSet = new Set(); idMap.set(current, idSet); }
249 idSet.add(elt.id);
250 current = current.parentElement;
251 }
252 }
253 }
254}
255
256function _queryEltAndDescendants(elt, selector) {
257 var results = [...(elt.querySelectorAll?.(selector) ?? [])];

Callers 1

_createIdMapsFunction · 0.70

Calls 2

getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected