aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormrmr19932015-02-17 23:24:06 +0000
committermrmr19932015-02-18 01:11:44 +0000
commit90f906b626d370a82f5143f84bf1384060386e46 (patch)
treed6226e5b45c5e7119459eb49cb48acb2682fa567 /lib
parent41626cdd7a52cb3595153e54f3f8c0c332373bb7 (diff)
downloadvimium-90f906b626d370a82f5143f84bf1384060386e46.tar.bz2
Remove redundant check, make isSelected's behaviour match its contract
Diffstat (limited to 'lib')
-rw-r--r--lib/dom_utils.coffee6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index 83fb045c..fae29e49 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -171,13 +171,11 @@ DomUtils =
# being accessed.
isSelected: (element) ->
if element.isContentEditable
- node = document.getSelection()?.anchorNode
+ node = document.getSelection().anchorNode
node and @isDOMDescendant element, node
else
- # Note. This makes the wrong decision if the user has placed the caret at the start of element. We
- # cannot distinguish that case from the user having made no selection.
try
- element.selectionEnd != 0
+ element.selectionStart != element.selectionEnd
catch
# This input element doesn't support selectionStart/selectionEnd.
# NOTE(mrmr1993): We choose true here because it does the right thing everywhere in the code. I am