File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -488,12 +488,14 @@ var Idiomorph = (function () {
488488 function preserveActiveElementPath ( oldParent , insertionPoint , newChild , ctx ) {
489489 const [ activeElement , newActiveElement ] =
490490 ctx . activeElementMap . get ( oldParent ) || [ ] ;
491+ if ( ! activeElement ) return insertionPoint ;
491492 // are we about to morph the active element or its ancestor?
492493 if ( newActiveElement === newChild ) {
494+ const beforePoint = activeElement . nextSibling ;
493495 while ( insertionPoint && insertionPoint !== activeElement ) {
494- // "move" the active element to the left by moving the current node to end of the parent
496+ // "move" the active element to the left by moving the current node after the active element
495497 let nextInsertionPoint = insertionPoint . nextSibling ;
496- moveBefore ( oldParent , insertionPoint , null ) ;
498+ moveBefore ( oldParent , insertionPoint , beforePoint ) ;
497499 insertionPoint = nextInsertionPoint ;
498500 }
499501 }
You can’t perform that action at this time.
0 commit comments