Skip to content

Commit

Permalink
minor cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
botandrose-machine committed Jan 15, 2025
1 parent b5b6560 commit 0bd9214
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/idiomorph.js
Original file line number Diff line number Diff line change
Expand Up @@ -1056,13 +1056,11 @@ var Idiomorph = (function () {
function populateIdMapForNode(nodeParent, nodes, persistentIds, idMap) {
for (const elt of nodes) {
if (persistentIds.has(elt.id)) {
/**
* @type {Element|null}
*/
/** @type {Element|null} */
let current = elt;
// walk up the parent hierarchy of that element, adding the id
// of element to the parent's id set
while (current !== nodeParent && current != null) {
while (current && current !== nodeParent) {
let idSet = idMap.get(current);
// if the id set doesn't exist, create it and insert it in the map
if (idSet == null) {
Expand Down Expand Up @@ -1094,7 +1092,7 @@ var Idiomorph = (function () {
for (const oldElt of oldElts) {
const id = oldElt.id;
// if already in map then log duplicates to be skipped
if (oldIdMap.get(id)) {
if (oldIdMap.has(id)) {
dupSet.add(id);
} else {
oldIdMap.set(id, oldElt.tagName);
Expand Down

0 comments on commit 0bd9214

Please sign in to comment.