aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
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 ||= {}