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.
Isaac Salier-Hellendag committed
Dec 3, 2014 at 14:03 UTC
6b46e80bb9c6e60eb743a7897ab8cf27d60d3faa
1 file changed
+5
-1
src/browser/ui/ReactDOMSelection.js
+5
-1
@@ -189,7 +189,11 @@ function setModernOffsets(node, offsets) {
189
}
190
}
191
192
-var useIEOffsets = ExecutionEnvironment.canUseDOM && document.selection;
192
+var useIEOffsets = (
193
+ ExecutionEnvironment.canUseDOM &&
194
+ 'selection' in document &&
195
+ !('getSelection' in window)
196
+);
197
198
var ReactDOMSelection = {
199
/**