code: public TextImpl replaceWithText() {
          TextImpl replacement = new TextImpl(document, getData());
          parent.insertBefore(replacement, this);
          parent.removeChild(this);
          return replacement;
      }
docs: Replaces this node with a semantically equivalent text node. This node
  will be removed from the DOM tree and the new node inserted in its place.
  
  @return the replacement node.