If you try to insert into a document a node that is already in the document through the DOM insertBefore() method, the node is first removed... It's explicitely said in the spec. But the nsIEditor method insertNode() doesn't do that. So if you use it to move a node, never forget to delete the node through deleteNode() before calling insertNode(). Your Undo stack will be horked if you don't do it...