Reduce number of intersection checks when undoing highlighting

Intersection checks become very expensive when updating the highlight on a large document. Intersections can only occur at the start and end of a range, allowing only two of these to be necessary.

Note, I've left the existing undoToTextNode function behind... please let me know if you want that removed as well!

More anecdotal evidence on my own rigs show in that one particular set of calls have dropped from ~60s to ~15s (it's a massive document I'm highlighting... would take up 1000 A4 pages if printed...).