The Range.deleteContents() method removes all completely-selected Node within this range from the document.
Range.deleteContents()
MDN Reference