diff options
| author | mrmr1993 | 2015-02-17 23:24:06 +0000 |
|---|---|---|
| committer | mrmr1993 | 2015-02-18 01:11:44 +0000 |
| commit | 90f906b626d370a82f5143f84bf1384060386e46 (patch) | |
| tree | d6226e5b45c5e7119459eb49cb48acb2682fa567 | |
| parent | 41626cdd7a52cb3595153e54f3f8c0c332373bb7 (diff) | |
| download | vimium-90f906b626d370a82f5143f84bf1384060386e46.tar.bz2 | |
Remove redundant check, make isSelected's behaviour match its contract
| -rw-r--r-- | lib/dom_utils.coffee | 6 |
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 |
