lib/dhtmlxVault/codebase/vault.js
// types (and tags if ELEM) are assumed the same, and donor exists
types (and tags if ELEM) are assumed the same, and donor exists
types ( and tags if ELEM ) are assumed the same and donor exists
function patch(vnode, donor) {
	fireHook(donor.hooks, "willRecycle", donor, vnode);
	var el = vnode.el = donor.el;
	var obody = donor.body;
	var nbody = vnode.body;
	el._node = vnode;
	if (vnode.type === TEXT && nbody !== obody) {
		el.nodeValue = nbody;
		return;
	}
	if (vnode.attrs != null || donor.attrs != null)
		{ patchAttrs(vnode, donor, false); }
	var oldIsArr = isArr(obody);
	var newIsArr = isArr(nbody);
	var lazyList = (vnode.flags & LAZY_LIST) === LAZY_LIST;
	if (oldIsArr) {
		if (newIsArr || lazyList)
			{ patchChildren(vnode, donor); }
		else if (nbody !== obody) {
			if (nbody != null)
				{ el.textContent = nbody; }
			else
				{ clearChildren(donor); }
		}
	}
	else {
		if (newIsArr) {
			clearChildren(donor);
			hydrateBody(vnode);
		}
		else if (nbody !== obody) {
			if (el.firstChild)
				{ el.firstChild.nodeValue = nbody; }
			else
				{ el.textContent = nbody; }
		}
	}
	fireHook(donor.hooks, "didRecycle", donor, vnode);
}
function patch ( vnode , donor ) { fireHook ( donor . hooks , "willRecycle" , donor , vnode ) ; var el = vnode . el = donor . el ; var obody = donor . body ; var nbody = vnode . body ; el . _node = vnode ; if ( vnode . type === TEXT && nbody !== obody ) { el . nodeValue = nbody ; return ; } if ( vnode . attrs != null || donor . attrs != null ) { patchAttrs ( vnode , donor , false ) ; } var oldIsArr = isArr ( obody ) ; var newIsArr = isArr ( nbody ) ; var lazyList = ( vnode . flags & LAZY_LIST ) === LAZY_LIST ; if ( oldIsArr ) { if ( newIsArr || lazyList ) { patchChildren ( vnode , donor ) ; } else if ( nbody !== obody ) { if ( nbody != null ) { el . textContent = nbody ; } else { clearChildren ( donor ) ; } } } else { if ( newIsArr ) { clearChildren ( donor ) ; hydrateBody ( vnode ) ; } else if ( nbody !== obody ) { if ( el . firstChild ) { el . firstChild . nodeValue = nbody ; } else { el . textContent = nbody ; } } } fireHook ( donor . hooks , "didRecycle" , donor , vnode ) ; }
types (and tags if ELEM) are assumed the same, and donor exists
types ( and tags if ELEM ) are assumed the same and donor exists
// "" => "" // patch events //	var nonEqNewBody = nbody != null && nbody !== obody; // [] => [] // [] => "" | null // "" | null => [] // "" | null => "" | null