From cd27269568380049425b9a0a2baab51311fca769 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 18 Jan 2015 11:25:56 +0000 Subject: Do not change selection if selection exists. Fixes #1430. --- lib/dom_utils.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/dom_utils.coffee') 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 ||= {} -- cgit v1.2.3