Largely fixes the reparenting problem.

This change fixes the fundamental problem behind the test that was failing
in the previous commit. When moving an element, the element needs to be
removed from the DOM so that the afterID and beforeIDs generated match up
correctly, so that DOM removal now happens at the rememberNodes edit.
This change also notices when an element has been moved relative to the
old DOM.

Note that the test is failing in a different way now: it adds two
textReplace edits that are identical when there should only be one.