diff options
| author | Stephen Blott | 2015-01-17 05:51:52 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2015-01-17 06:09:15 +0000 | 
| commit | 9cb0f2853a155e39270282e6ed224966afffc61e (patch) | |
| tree | d180bb45baea4a34be20db7512fff0851b89f706 /content_scripts/mode_insert.coffee | |
| parent | cd49c88eaad6550ba768159347be6c88f1c26d15 (diff) | |
| download | vimium-9cb0f2853a155e39270282e6ed224966afffc61e.tar.bz2 | |
Modes; yet more tweaks...
- Mainly comments.
- Rename chooseBadge to updateBadge (for consistency).
- No badge for passkeys; also fix tests.
Diffstat (limited to 'content_scripts/mode_insert.coffee')
| -rw-r--r-- | content_scripts/mode_insert.coffee | 16 | 
1 files changed, 8 insertions, 8 deletions
diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee index ef7223ad..123c72be 100644 --- a/content_scripts/mode_insert.coffee +++ b/content_scripts/mode_insert.coffee @@ -1,14 +1,14 @@  class InsertMode extends Mode -  # There is one permanently-installed instance of InsertMode.  It watches for focus changes and -  # activates/deactivates itself accordingly. +  # There is one permanently-installed instance of InsertMode.  It tracks focus changes and +  # activates/deactivates itself (by setting @insertModeLock) accordingly.    @permanentInstance: null    constructor: (options = {}) ->      InsertMode.permanentInstance ||= @      @permanent = (@ == InsertMode.permanentInstance) -    # If truthy, then options.global indicates that we were activated by the user (with "i"). +    # If truthy, then we were activated by the user (with "i").      @global = options.global      defaults = @@ -21,7 +21,7 @@ class InsertMode extends Mode      @insertModeLock =        if document.activeElement and DomUtils.isEditable document.activeElement -        #  An input element is already active, so use it. +        # An input element is already active, so use it.          document.activeElement        else          null @@ -30,9 +30,9 @@ class InsertMode extends Mode        "blur": (event) => @alwaysContinueBubbling =>          target = event.target          # We can't rely on focus and blur events arriving in the expected order.  When the active element -        # changes, we might get "blur" before "focus".  We track the active element in @insertModeLock, and +        # changes, we might get "focus" before "blur".  We track the active element in @insertModeLock, and          # exit only when that element blurs. -        @exit event, target if target == @insertModeLock and DomUtils.isFocusable target +        @exit event, target if target == @insertModeLock        "focus": (event) => @alwaysContinueBubbling =>          if @insertModeLock != event.target and DomUtils.isFocusable event.target            @insertModeLock = event.target @@ -44,7 +44,7 @@ class InsertMode extends Mode      # Some sites (e.g. inbox.google.com) change the contentEditable property on the fly (see #1245); and      # unfortunately, the focus event fires *before* the change.  Therefore, we need to re-check whether the      # active element is contentEditable. -    if document.activeElement?.isContentEditable and @insertModeLock != document.activeElement +    if @insertModeLock != document.activeElement and document.activeElement?.isContentEditable        @insertModeLock = document.activeElement        Mode.updateBadge()      @insertModeLock != null @@ -75,7 +75,7 @@ class InsertMode extends Mode    updateBadge: (badge) ->      badge.badge ||= "I" if @isActive badge -  # Static stuff. This allows PostFindMode to suppress insert mode. +  # Static stuff. This allows PostFindMode to suppress the permanently-installed InsertMode instance.    @suppressedEvent: null    @suppressEvent: (event) -> @suppressedEvent = event  | 
