Use getSelection in IE where available

IE9+ has support for window.getSelection, but we’re still using
document.selection for IE9/10. Only use the old IE selection API if the
modern one is unavailable.
Merge pull request #2653 from salier/ie-selection

Use getSelection in IE where available