Should add the note here that if both `afterID` and `beforeID` are unset, then the text node must be the only child of its parent and that's the one to replace.