code: function () {
              var prev = prevNode();
              if (prev && !prev.children) {
                  newEdit = {
                      type: "textReplace",
                      content: prev.content
                  };
              } else {
                  newEdit = {
                      type: "textDelete"
                  };
              }
  
              // When elements are deleted or moved from the old set of children, you
              // can end up with multiple text nodes in a row. A single textReplace edit
              // will take care of those (and will contain all of the right content since
              // the text nodes between elements in the new DOM are merged together).
              // The check below looks to see if we're already in the process of adding
              // a textReplace edit following the same element.
              var previousEdit = newEdits.length > 0 && newEdits[newEdits.length - 1];
              if (previousEdit && previousEdit.type === "textReplace" &&
                      previousEdit.afterID === textAfterID) {
                  oldIndex++;
                  return;
              }
  
              newEdit.parentID = oldChild.parent.tagID;
  
              // If there was only one child previously, we just pass along
              // textDelete/textReplace with the parentID and the browser will
              // clear all of the children
              if (oldChild.parent.children.length === 1) {
                  newEdits.push(newEdit);
              } else {
                  if (textAfterID) {
                      newEdit.afterID = textAfterID;
                  }
                  newEdits.push(newEdit);
              }
  
              // This text appeared in the old tree but not the new one, so we
              // increment the old children counter.
              oldIndex++;
          }
docs: Adds a textDelete edit for text node that is not in the new tree.
  Note that we actually create a textReplace rather than a textDelete
  if the previous node in current tree was a text node. We do this because
  text nodes are not individually addressable and a delete event would
  end up clearing out both that previous text node that we want to keep
  and this text node that we want to eliminate. Instead, we just log
  a textReplace which will result in the deletion of this node and
  the maintaining of the old content.