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

Function _createIdMaps

src/core/runtime/morph.js:217–225  ·  view source on GitHub ↗
(oldNode, newContent)

Source from the content-addressed store, hash-verified

215}
216
217function _createIdMaps(oldNode, newContent) {
218 var oldIdElements = _queryEltAndDescendants(oldNode, "[id]");
219 var newIdElements = newContent.querySelectorAll("[id]");
220 var persistentIds = _createPersistentIds(oldIdElements, newIdElements);
221 var idMap = new Map();
222 _populateIdMapWithTree(idMap, persistentIds, oldNode.parentElement, oldIdElements);
223 _populateIdMapWithTree(idMap, persistentIds, newContent, newIdElements);
224 return { persistentIds, idMap };
225}
226
227function _createPersistentIds(oldIdElements, newIdElements) {
228 var duplicateIds = new Set(), oldIdTagNameMap = new Map();

Callers 1

morphMethod · 0.70

Calls 3

_queryEltAndDescendantsFunction · 0.70
_createPersistentIdsFunction · 0.70
_populateIdMapWithTreeFunction · 0.70

Tested by

no test coverage detected