@@ -356,7 +356,7 @@ var Idiomorph = (function () {
356356 */
357357 function createNode ( oldParent , newChild , insertionPoint , ctx ) {
358358 if ( ctx . callbacks . beforeNodeAdded ( newChild ) === false ) return null ;
359- if ( hasPersistentIdNodes ( ctx , newChild ) && newChild instanceof Element ) {
359+ if ( ctx . idMap . has ( newChild ) && newChild instanceof Element ) {
360360 // node has children with ids with possible state so create a dummy elt of same type and apply full morph algorithm
361361 const newEmptyChild = document . createElement ( newChild . tagName ) ;
362362 oldParent . insertBefore ( newEmptyChild , insertionPoint ) ;
@@ -399,9 +399,9 @@ var Idiomorph = (function () {
399399 // we haven't yet saved a soft match fallback
400400 if ( ! softMatch ) {
401401 // the current soft match will hard match something else in the future, leave it
402- if ( ! hasPersistentIdNodes ( ctx , cursor ) ) {
402+ if ( ! ctx . idMap . has ( cursor ) ) {
403403 // optimization: if node can't id set match, we can just return the soft match immediately
404- if ( ! hasPersistentIdNodes ( ctx , node ) ) {
404+ if ( ! ctx . idMap . has ( node ) ) {
405405 return cursor ;
406406 } else {
407407 // save this as the fallback if we get through the loop without finding a hard match
@@ -456,7 +456,7 @@ var Idiomorph = (function () {
456456 */
457457 function removeNode ( ctx , node , nextNewChild = null , endPoint = null ) {
458458 // are we going to id set match this later?
459- if ( hasPersistentIdNodes ( ctx , node ) && node instanceof Element ) {
459+ if ( ctx . idMap . has ( node ) && node instanceof Element ) {
460460 // skip callbacks and move to pantry
461461 moveBefore ( ctx . pantry , node , null ) ;
462462
@@ -551,33 +551,6 @@ var Idiomorph = (function () {
551551 // ID Set Functions
552552 //=============================================================================
553553
554- /**
555- *
556- * @type {Set<string> }
557- */
558- let EMPTY_SET = new Set ( ) ;
559-
560- /**
561- *
562- * @param {MorphContext } ctx
563- * @param {Node } node
564- * @returns {number }
565- */
566- function getPersistentIdNodeCount ( ctx , node ) {
567- let idSet = ctx . idMap . get ( node ) || EMPTY_SET ;
568- return idSet . size ;
569- }
570-
571- /**
572- *
573- * @param {MorphContext } ctx
574- * @param {Node } node
575- * @returns {boolean }
576- */
577- function hasPersistentIdNodes ( ctx , node ) {
578- return getPersistentIdNodeCount ( ctx , node ) > 0 ;
579- }
580-
581554 /**
582555 *
583556 * @param {Node } oldNode
0 commit comments