aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2017-11-03 07:06:32 +0000
committerGitHub2017-11-03 07:06:32 +0000
commit1eceb1413b43b0b43f225a5270dc9f2e6c212836 (patch)
tree7b3bb922916e246fbeeb71c53d6263f996ead4bc /lib
parente3ca00a9f6402730b21a059a751a1b6f1d9d19ea (diff)
parent66cd3b27c2183bc1cc2dcc1aac82d7c12ffeff54 (diff)
downloadvimium-1eceb1413b43b0b43f225a5270dc9f2e6c212836.tar.bz2
Merge pull request #2766 from mrmr1993/bugs-fixup
Fix comments from #2763 and #2762
Diffstat (limited to 'lib')
-rw-r--r--lib/dom_utils.coffee6
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