src/language/HTMLDOMDiff.js
function () {

            // This check looks a little strange, but it suits what we're trying
            // to do: as we're walking through the children, a child node that has moved
            // from one parent to another will be found but would look like some kind
            // of insert. The check that we're doing here is looking up the current
            // child's ID in the *old* map and seeing if this child used to have a
            // different parent.
            var possiblyMovedElement = oldNodeMap[newChild.tagID];
            if (possiblyMovedElement &&
                    newParent.tagID !== getParentID(possiblyMovedElement)) {
                newEdit = {
                    type: "elementMove",
                    tagID: newChild.tagID,
                    parentID: newChild.parent.tagID
                };
                moves.push(newEdit.tagID);
                newEdits.push(newEdit);

                // this element in the new tree was a move to this spot, so we can move
                // on to the next child in the new tree.
                newIndex++;
                return true;
            }
            return false;
        }
function () {

            // This check looks a little strange, but it suits what we're trying
            // to do: as we're walking through the children, a child node that has moved
            // from one parent to another will be found but would look like some kind
            // of insert. The check that we're doing here is looking up the current
            // child's ID in the *old* map and seeing if this child used to have a
            // different parent.
            var possiblyMovedElement = oldNodeMap[newChild.tagID];
            if (possiblyMovedElement &&
                    newParent.tagID !== getParentID(possiblyMovedElement)) {
                newEdit = {
                    type: "elementMove",
                    tagID: newChild.tagID,
                    parentID: newChild.parent.tagID
                };
                moves.push(newEdit.tagID);
                newEdits.push(newEdit);

                // this element in the new tree was a move to this spot, so we can move
                // on to the next child in the new tree.
                newIndex++;
                return true;
            }
            return false;
        }
function ( ) { // This check looks a little strange, but it suits what we're trying // to do: as we're walking through the children, a child node that has moved // from one parent to another will be found but would look like some kind // of insert. The check that we're doing here is looking up the current // child's ID in the *old* map and seeing if this child used to have a // different parent. var possiblyMovedElement = oldNodeMap [ newChild . tagID ] ; if ( possiblyMovedElement && newParent . tagID !== getParentID ( possiblyMovedElement ) ) { newEdit = { type : "elementMove" , tagID : newChild . tagID , parentID : newChild . parent . tagID } ; moves . push ( newEdit . tagID ) ; newEdits . push ( newEdit ) ; // this element in the new tree was a move to this spot, so we can move // on to the next child in the new tree. newIndex ++ ; return true ; } return false ; }
Adds an elementMove edit if the parent has changed between the old and new trees.
These are fairly infrequent and generally occur if you make a change across
tag boundaries.

@return {boolean} true if an elementMove was generated
Adds an elementMove edit if the parent has changed between the old and new trees . These are fairly infrequent and generally occur if you make a change across tag boundaries .