Collapses Ranges and Selections in a cross-browser way.