This is only done because rangeToSelection(...) needs a Range object, right? How expensive are Range objects? Perhaps we could optimize by having rangeToSelection(...) just taking an object with the start/end container/offset properties?