From ab56d8bcd6686991483694d7153c4d0c9b5e513a Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Wed, 14 Jan 2015 13:33:29 +0000 Subject: Modes; fix tests. --- content_scripts/mode.coffee | 6 +++--- content_scripts/mode_insert.coffee | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee index 2b35f0de..ab482e8f 100644 --- a/content_scripts/mode.coffee +++ b/content_scripts/mode.coffee @@ -44,7 +44,7 @@ count = 0 class Mode # If Mode.debug is true, then we generate a trace of modes being activated and deactivated on the console, along # with a list of the currently active modes. - debug: true + debug: false @modes: [] # Constants; short, readable names for handlerStack event-handler return values. @@ -95,7 +95,7 @@ class Mode if @options.exitOnBlur @push _name: "mode-#{@id}/exitOnBlur" - "blur": (event) => @alwaysContinueBubbling => @exit() if event.srcElement == @options.exitOnBlur + "blur": (event) => @alwaysContinueBubbling => @exit() if event.target == @options.exitOnBlur # If @options.exitOnClick is truthy, then the mode will exit on any click event. if @options.exitOnClick @@ -192,7 +192,7 @@ class Mode # Return the name of the must-recently activated mode. @top: -> - @modes[@modes.length-1]?.name + @modes[@modes.length-1] # BadgeMode is a pseudo mode for triggering badge updates on focus changes and state updates. It sits at the # bottom of the handler stack, and so it receives state changes *after* all other modes, and can override the diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee index 89077c6a..135df0d0 100644 --- a/content_scripts/mode_insert.coffee +++ b/content_scripts/mode_insert.coffee @@ -16,7 +16,7 @@ class InsertMode extends Mode @insertModeLock = if options.targetElement? then options.targetElement else null @push - "blur": => @alwaysContinueBubbling => + "blur": (event) => @alwaysContinueBubbling => if DomUtils.isFocusable event.target @exit event.target Mode.updateBadge() -- cgit v1.2.3