@@ -256,7 +256,6 @@ var Idiomorph = (function () {
256256 * - if match found
257257 * - remove any nodes up to the match:
258258 * - pantry persistent nodes
259- * - shuffle soft matches to the end for later reuse
260259 * - delete the rest
261260 * - morph the match
262261 * - elsif no match found, and node is persistent
@@ -304,14 +303,7 @@ var Idiomorph = (function () {
304303 if ( bestMatch ) {
305304 // if the node to morph is not at the insertion point then remove/move up to it
306305 if ( bestMatch !== insertionPoint ) {
307- removeNodesBetween (
308- ctx ,
309- insertionPoint ,
310- bestMatch ,
311- // additional args so that we can retain future soft matches
312- newChild . nextSibling ,
313- endPoint ,
314- ) ;
306+ removeNodesBetween ( ctx , insertionPoint , bestMatch ) ;
315307 }
316308 morphNode ( bestMatch , newChild , ctx ) ;
317309 insertionPoint = bestMatch . nextSibling ;
@@ -471,26 +463,16 @@ var Idiomorph = (function () {
471463
472464 /**
473465 * Gets rid of an unwanted DOM node; strategy depends on nature of its reuse:
474- * - Persistent nodes will be moved to the pantry for later reuse by removeNode
475- * - Future soft-matchable nodes will be moved to the end of the parent for later reuse
476- * - Finally, unreusable nodes will have the hooks called, and then are removed
466+ * - Persistent nodes will be moved to the pantry for later reuse
467+ * - Other nodes will have their hooks called, and then are removed
477468 * @param {MorphContext } ctx
478469 * @param {Node } node
479- * @param {Node|null } nextNewChild
480- * @param {Node|null } endPoint
481470 */
482- function removeNode ( ctx , node , nextNewChild = null , endPoint = null ) {
471+ function removeNode ( ctx , node ) {
483472 // are we going to id set match this later?
484473 if ( ctx . idMap . has ( node ) && node instanceof Element ) {
485474 // skip callbacks and move to pantry
486475 moveBefore ( ctx . pantry , node , null ) ;
487-
488- // will be soft-matched to an upcoming new sibling?
489- } else if ( findBestMatch ( ctx , node , nextNewChild , null ) ) {
490- // skip callbacks and move to the end of the parent for later soft matching
491- moveBefore ( /** @type {Element } */ ( node . parentNode ) , node , endPoint ) ;
492-
493- // unreusable
494476 } else {
495477 // remove for realsies
496478 if ( ctx . callbacks . beforeNodeRemoved ( node ) === false ) return ;
@@ -504,24 +486,16 @@ var Idiomorph = (function () {
504486 * @param {MorphContext } ctx
505487 * @param {Node } startInclusive
506488 * @param {Node } endExclusive
507- * @param {Node|null } nextNewChild
508- * @param {Node|null } endPoint
509489 * @returns {Node|null }
510490 */
511- function removeNodesBetween (
512- ctx ,
513- startInclusive ,
514- endExclusive ,
515- nextNewChild ,
516- endPoint ,
517- ) {
491+ function removeNodesBetween ( ctx , startInclusive , endExclusive ) {
518492 /** @type {Node | null } */
519493 let cursor = startInclusive ;
520494 // remove nodes until the endExclusive node
521495 while ( cursor && cursor !== endExclusive ) {
522496 let tempNode = /** @type {Node } */ ( cursor ) ;
523497 cursor = cursor . nextSibling ;
524- removeNode ( ctx , tempNode , nextNewChild , endPoint ) ;
498+ removeNode ( ctx , tempNode ) ;
525499 }
526500 return cursor ;
527501 }
0 commit comments