The Selection.removeRange() method removes a range from a selection.
Selection.removeRange()
MDN Reference