diff options
| author | Stephen Blott | 2016-01-28 12:40:27 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2016-01-28 12:40:27 +0000 | 
| commit | 34e2fe6fd53d32b0f4b2f6463cea25ae4ad24927 (patch) | |
| tree | b7589cbd257f78caf17d9b7127a5d1d539989859 /lib | |
| parent | adafa5e8546627e993da6d03b59a27fd4a9162b7 (diff) | |
| parent | a3a8ede00fa1405135d519dc0015e65953318a2c (diff) | |
| download | vimium-34e2fe6fd53d32b0f4b2f6463cea25ae4ad24927.tar.bz2 | |
Merge pull request #1943 from smblott-github/do-not-move-selection-in-textareas
Disable position-at-end in text areas.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 19 | 
1 files changed, 10 insertions, 9 deletions
| diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index ee7d415f..027188bf 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -223,15 +223,16 @@ DomUtils =        handlerStack.bubbleEvent "click", target: element      else        element.focus() -      # If the cursor is at the start of the element's contents, send it to the end. Motivation: -      # * the end is a more useful place to focus than the start, -      # * this way preserves the last used position (except when it's at the beginning), so the user can -      #   'resume where they left off'. -      # NOTE(mrmr1993): Some elements throw an error when we try to access their selection properties, so -      # wrap this with a try. -      try -        if element.selectionStart == 0 and element.selectionEnd == 0 -          element.setSelectionRange element.value.length, element.value.length +      if element.tagName.toLowerCase() != "textarea" +        # If the cursor is at the start of the (non-textarea) element's contents, send it to the end. Motivation: +        # * the end is a more useful place to focus than the start, +        # * this way preserves the last used position (except when it's at the beginning), so the user can +        #   'resume where they left off'. +        # NOTE(mrmr1993): Some elements throw an error when we try to access their selection properties, so +        # wrap this with a try. +        try +          if element.selectionStart == 0 and element.selectionEnd == 0 +            element.setSelectionRange element.value.length, element.value.length | 
