The Range.setStartBefore() method sets the start position of a Range relative to another Node.
Range.setStartBefore()
MDN Reference