 
       keyup: =>
         if seenKeyDown
-          unless 0 < --keyDownCount
-            unless 0 < --count
+          unless --keyDownCount > 0
+            unless --count > 0
               @exit()
         @passEventToPage
 

    super.init(extend(defaults, options))

    # Only for tests.  This gives us a hook to test the status of the permanently-installed instance.
    InsertMode.permanentInstance = this if @permanent

  isActive: (event) ->
    return false if event == InsertMode.suppressedEvent
    return true if @global
    DomUtils.isFocusable @getActiveElement()

  getActiveElement: ->
    activeElement = document.activeElement
    while activeElement?.shadowRoot?.activeElement
      activeElement = activeElement.shadowRoot.activeElement
    activeElement

  # Static stuff. This allows PostFindMode to suppress the permanently-installed InsertMode instance.
  @suppressedEvent: null
  @suppressEvent: (event) -> @suppressedEvent = event

# This implements the pasNexKey command.
class PassNextKeyMode extends Mode

    @global = options.global

    handleKeyEvent = (event) =>
      unless @isActive event
        return @continueBubbling

      # See comment here: https://github.com/philc/vimium/commit/48c169bd5a61685bb4e67b1e76c939dbf360a658.
      activeElement = @getActiveElement()
      if activeElement == document.body and activeElement.isContentEditable
        return @passEventToPage

      # Check for a pass-next-key key.
      keyString = KeyboardUtils.getKeyCharString(event)
      if keyString in Settings.get "passNextKeyKeys"
        new PassNextKeyMode

      else if event.type == 'keydown' and KeyboardUtils.isEscape(event)
        activeElement.blur() if DomUtils.isFocusable activeElement
        unless @permanent
          @exit()

      else
        return @passEventToPage
