lib/imba/dom/reconciler.js
function(root,new$,old,caret) {
	var nl = new$.length;
	var ol = old.length;
	var cl = new$.cache.i$; // cache-length
	var i = 0,d = nl - ol;
	
	// TODO support caret
	
	// find the first index that is different
	while (i < ol && i < nl && new$[i] === old[i]){
		i++;
	};
	
	// conditionally prune cache
	if (cl > 1000 && (cl - nl) > 500) {
		new$.cache.$prune(new$);
	};
	
	if (d > 0 && i == ol) {
		// added at end
		while (i < nl){
			root.appendChild(new$[i++]);
		};
		return;
	} else if (d > 0) {
		var i1 = nl;
		while (i1 > i && new$[i1 - 1] === old[i1 - 1 - d]){
			i1--;
		};
		
		if (d == (i1 - i)) {
			var before = old[i]._slot_;
			while (i < i1){
				root.insertBefore(new$[i++],before);
			};
			return;
		};
	} else if (d < 0 && i == nl) {
		// removed at end
		while (i < ol){
			root.removeChild(old[i++]);
		};
		return;
	} else if (d < 0) {
		var i11 = ol;
		while (i11 > i && new$[i11 - 1 + d] === old[i11 - 1]){
			i11--;
		};
		
		if (d == (i - i11)) {
			while (i < i11){
				root.removeChild(old[i++]);
			};
			return;
		};
	} else if (i == nl) {
		return;
	};
	
	return reconcileCollectionChanges(root,new$,old,caret);
}
function(root,new$,old,caret) {
	var nl = new$.length;
	var ol = old.length;
	var cl = new$.cache.i$; // cache-length
	var i = 0,d = nl - ol;
	
	// TODO support caret
	
	// find the first index that is different
	while (i < ol && i < nl && new$[i] === old[i]){
		i++;
	};
	
	// conditionally prune cache
	if (cl > 1000 && (cl - nl) > 500) {
		new$.cache.$prune(new$);
	};
	
	if (d > 0 && i == ol) {
		// added at end
		while (i < nl){
			root.appendChild(new$[i++]);
		};
		return;
	} else if (d > 0) {
		var i1 = nl;
		while (i1 > i && new$[i1 - 1] === old[i1 - 1 - d]){
			i1--;
		};
		
		if (d == (i1 - i)) {
			var before = old[i]._slot_;
			while (i < i1){
				root.insertBefore(new$[i++],before);
			};
			return;
		};
	} else if (d < 0 && i == nl) {
		// removed at end
		while (i < ol){
			root.removeChild(old[i++]);
		};
		return;
	} else if (d < 0) {
		var i11 = ol;
		while (i11 > i && new$[i11 - 1 + d] === old[i11 - 1]){
			i11--;
		};
		
		if (d == (i - i11)) {
			while (i < i11){
				root.removeChild(old[i++]);
			};
			return;
		};
	} else if (i == nl) {
		return;
	};
	
	return reconcileCollectionChanges(root,new$,old,caret);
}
function ( root , new$ , old , caret ) { var nl = new$ . length ; var ol = old . length ; var cl = new$ . cache . i$ ; // cache-length var i = 0 , d = nl - ol ; // TODO support caret // find the first index that is different while ( i < ol && i < nl && new$ [ i ] === old [ i ] ) { i ++ ; } ; // conditionally prune cache if ( cl > 1000 && ( cl - nl ) > 500 ) { new$ . cache . $prune ( new$ ) ; } ; if ( d > 0 && i == ol ) { // added at end while ( i < nl ) { root . appendChild ( new$ [ i ++ ] ) ; } ; return ; } else if ( d > 0 ) { var i1 = nl ; while ( i1 > i && new$ [ i1 - 1 ] === old [ i1 - 1 - d ] ) { i1 -- ; } ; if ( d == ( i1 - i ) ) { var before = old [ i ] . _slot_ ; while ( i < i1 ) { root . insertBefore ( new$ [ i ++ ] , before ) ; } ; return ; } ; } else if ( d < 0 && i == nl ) { // removed at end while ( i < ol ) { root . removeChild ( old [ i ++ ] ) ; } ; return ; } else if ( d < 0 ) { var i11 = ol ; while ( i11 > i && new$ [ i11 - 1 + d ] === old [ i11 - 1 ] ) { i11 -- ; } ; if ( d == ( i - i11 ) ) { while ( i < i11 ) { root . removeChild ( old [ i ++ ] ) ; } ; return ; } ; } else if ( i == nl ) { return ; } ; return reconcileCollectionChanges ( root , new$ , old , caret ) ; }
TYPE 5 - we know that we are dealing with a single array of keyed tags - and root has no other children
TYPE 5 - we know that we are dealing with a single array of keyed tags - and root has no other children