aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2015-01-18 11:25:56 +0000
committerStephen Blott2015-01-18 11:25:56 +0000
commitcd27269568380049425b9a0a2baab51311fca769 (patch)
tree1d8fe38d700b07118d271711e884834911c31962 /lib
parentf484718185675bd80eb005f39dd7bdbbdfd497fa (diff)
downloadvimium-cd27269568380049425b9a0a2baab51311fca769.tar.bz2
Do not change selection if selection exists.
Fixes #1430.
Diffstat (limited to 'lib')
-rw-r--r--lib/dom_utils.coffee7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index aee2f972..2cf94a14 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -177,9 +177,10 @@ DomUtils =
simulateSelect: (element) ->
element.focus()
- # When focusing a textbox, put the selection caret at the end of the textbox's contents.
- # For some HTML5 input types (eg. date) we can't position the caret, so we wrap this with a try.
- try element.setSelectionRange(element.value.length, element.value.length)
+ unless @isSelected element
+ # When focusing a textbox, put the selection caret at the end of the textbox's contents.
+ # For some HTML5 input types (eg. date) we can't position the caret, so we wrap this with a try.
+ try element.setSelectionRange(element.value.length, element.value.length)
simulateClick: (element, modifiers) ->
modifiers ||= {}