Skip to content

Commit

Permalink
fix(IE): Fix selection api on IE
Browse files Browse the repository at this point in the history
  • Loading branch information
STRML committed Sep 26, 2017
1 parent 4a75c44 commit d4fb37f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/utils/domFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,14 @@ export function addUserSelectStyles(doc: Document) {

export function removeUserSelectStyles(doc: Document) {
if (doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection');
window.getSelection().removeAllRanges(); // remove selection caused by scroll
try {
if (doc.selection) {
// $FlowIgnore: IE
doc.selection.empty();
} else {
window.getSelection().removeAllRanges(); // remove selection caused by scroll
}
} catch (e) { /* ignore */ }
}

export function styleHacks(childStyle: Object = {}): Object {
Expand Down

0 comments on commit d4fb37f

Please sign in to comment.