Skip to content

Commit

Permalink
minimize the movement of the nodes during active element preservation.
Browse files Browse the repository at this point in the history
Co-authored-by: MichaelWest22 <[email protected]>
  • Loading branch information
botandrose-machine and MichaelWest22 committed Jan 6, 2025
1 parent 9aed82c commit 9f9d57e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/idiomorph.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,11 @@ var Idiomorph = (function () {
ctx.activeElementMap.get(oldParent) || [];
// are we about to morph the active element or its ancestor?
if (newActiveElement === newChild) {
const beforePoint = activeElement.nextSibling
while (insertionPoint && insertionPoint !== activeElement) {
// "move" the active element to the left by moving the current node to end of the parent
// "move" the active element to the left by moving the current node after the active element
let nextInsertionPoint = insertionPoint.nextSibling;
moveBefore(oldParent, insertionPoint, null);
moveBefore(oldParent, insertionPoint, beforePoint);
insertionPoint = nextInsertionPoint;
}
}
Expand Down

0 comments on commit 9f9d57e

Please sign in to comment.