···154154155155 while (current) {
156156 const idSet: IdSet | undefined = this.#idMap.get(current)
157157- idSet ? idSet.add(id) : this.#idMap.set(current, new Set([id]))
157157+ if (idSet) idSet.add(id)
158158+ else this.#idMap.set(current, new Set([id]))
158159 if (current === node) break
159160 current = current.parentElement
160161 }
···218219219220 // If the child is in the reference map already, we don't need to add it later.
220221 // If it's not in the map, we need to remove it from the node.
221221- refChild ? refChildNodesMap.delete(key) : this.#removeNode(child)
222222+ if (refChild) refChildNodesMap.delete(key)
223223+ else this.#removeNode(child)
222224 }
223225224226 // Any remaining nodes in the map should be appended to the head.