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

Function _createIdMaps

www/js/_hyperscript.esm.js:3707–3715  ·  view source on GitHub ↗
(oldNode, newContent)

Source from the content-addressed store, hash-verified

3705 return !oldNode.id || oldNode.id === newNode.id;
3706}
3707function _createIdMaps(oldNode, newContent) {
3708 var oldIdElements = _queryEltAndDescendants(oldNode, "[id]");
3709 var newIdElements = newContent.querySelectorAll("[id]");
3710 var persistentIds = _createPersistentIds(oldIdElements, newIdElements);
3711 var idMap = /* @__PURE__ */ new Map();
3712 _populateIdMapWithTree(idMap, persistentIds, oldNode.parentElement, oldIdElements);
3713 _populateIdMapWithTree(idMap, persistentIds, newContent, newIdElements);
3714 return { persistentIds, idMap };
3715}
3716function _createPersistentIds(oldIdElements, newIdElements) {
3717 var duplicateIds = /* @__PURE__ */ new Set(), oldIdTagNameMap = /* @__PURE__ */ new Map();
3718 for (var { id, tagName } of oldIdElements) {

Callers 1

morphMethod · 0.70

Calls 3

_queryEltAndDescendantsFunction · 0.70
_createPersistentIdsFunction · 0.70
_populateIdMapWithTreeFunction · 0.70

Tested by

no test coverage detected