diff options
| author | mrmr1993 | 2017-11-02 18:31:32 +0000 |
|---|---|---|
| committer | mrmr1993 | 2017-11-02 18:31:32 +0000 |
| commit | f10dfa843c60266504469fb5ea4d6222b051364b (patch) | |
| tree | 1491fc98ebe6250f8b42b84d359eded4aca300af /lib | |
| parent | 73b1bd8057ef9b71f12bca5e81dae0103281800b (diff) | |
| download | vimium-f10dfa843c60266504469fb5ea4d6222b051364b.tar.bz2 | |
Replace all references to selection.type with our FF polyfill
Credit to @gdh1995 for catching these oversights.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index b44f5f51..d8a5d203 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -219,7 +219,7 @@ DomUtils = node = selection.anchorNode node and @isDOMDescendant element, node else - if selection.type == "Range" and selection.isCollapsed + if DomUtils.getSelectionType(selection) == "Range" and selection.isCollapsed # The selection is inside the Shadow DOM of a node. We can check the node it registers as being # before, since this represents the node whose Shadow DOM it's inside. containerNode = selection.anchorNode.childNodes[selection.anchorOffset] @@ -364,7 +364,7 @@ DomUtils = handlerStack.suppressEvent # Polyfill for selection.type (which is not available in Firefox). - getSelectionType: (selection) -> + getSelectionType: (selection = document.getSelection()) -> selection.type or do -> if selection.rangeCount == 0 "None" @@ -377,7 +377,7 @@ DomUtils = # This finds the element containing the selection focus. getElementWithFocus: (selection, backwards) -> r = t = selection.getRangeAt 0 - if selection.type == "Range" + if DomUtils.getSelectionType(selection) == "Range" r = t.cloneRange() r.collapse backwards t = r.startContainer |
