aboutsummaryrefslogtreecommitdiffstats
path: root/lib/handler_stack.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handler_stack.coffee')
-rw-r--r--lib/handler_stack.coffee20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee
index 764461e7..d2d0672a 100644
--- a/lib/handler_stack.coffee
+++ b/lib/handler_stack.coffee
@@ -5,8 +5,14 @@ class HandlerStack
constructor: ->
@stack = []
@counter = 0
- @passDirectlyToPage = new Object() # Used only as a constant, distinct from any other value.
- @eventConsumed = new Object() # Used only as a constant, distinct from any other value.
+
+ # A handler should return this value to immediately discontinue bubbling and pass the event on to the
+ # underlying page.
+ @stopBubblingAndTrue = new Object()
+
+ # A handler should return this value to indicate that the event has been consumed, and no further
+ # processing should take place.
+ @stopBubblingAndFalse = new Object()
genId: -> @counter = ++@counter
@@ -29,14 +35,8 @@ class HandlerStack
if not passThrough
DomUtils.suppressEvent(event) if @isChromeEvent event
return false
- # If the constant @passDirectlyToPage is returned, then discontinue further bubbling and pass the
- # event through to the underlying page. The event is not suppresssed.
- if passThrough == @passDirectlyToPage
- return false
- # If the constant @eventConsumed is returned, then discontinue further bubbling and
- # return false.
- if passThrough == @eventConsumed
- return false
+ return true if passThrough == @stopBubblingAndTrue
+ return false if passThrough == @stopBubblingAndFalse
true
remove: (id = @currentId) ->