diff options
| author | Stephen Blott | 2015-01-18 11:25:56 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-18 11:25:56 +0000 |
| commit | cd27269568380049425b9a0a2baab51311fca769 (patch) | |
| tree | 1d8fe38d700b07118d271711e884834911c31962 | |
| parent | f484718185675bd80eb005f39dd7bdbbdfd497fa (diff) | |
| download | vimium-cd27269568380049425b9a0a2baab51311fca769.tar.bz2 | |
Do not change selection if selection exists.
Fixes #1430.
| -rw-r--r-- | lib/dom_utils.coffee | 7 |
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 ||= {} |
