Prevent DOM error when trying to delete a selection after selecting, typing, then deleting