aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2014-12-31 19:04:26 +0000
committerStephen Blott2014-12-31 20:00:07 +0000
commitf2b428b4fe1eecd66ee95513da779470f7c621aa (patch)
tree038032ba697ec0a46b1647b73866901195b27520 /lib
parent4a00f76f2ad3d0ec8cdb70c7e45f561d5a73ff27 (diff)
downloadvimium-f2b428b4fe1eecd66ee95513da779470f7c621aa.tar.bz2
Modes proof-of-concept.
Diffstat (limited to 'lib')
-rw-r--r--lib/handler_stack.coffee8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee
index 858f2ec9..728ea4bc 100644
--- a/lib/handler_stack.coffee
+++ b/lib/handler_stack.coffee
@@ -5,6 +5,7 @@ class root.HandlerStack
constructor: ->
@stack = []
@counter = 0
+ @passThrough = {}
genId: -> @counter = ++@counter & 0xffff
@@ -18,6 +19,7 @@ class root.HandlerStack
# propagation by returning a falsy value.
bubbleEvent: (type, event) ->
for i in [(@stack.length - 1)..0] by -1
+ console.log i, type
handler = @stack[i]
# We need to check for existence of handler because the last function call may have caused the release
# of more than one handler.
@@ -27,6 +29,10 @@ class root.HandlerStack
if not passThrough
DomUtils.suppressEvent(event)
return false
+ # If @passThrough is returned, then discontinue further bubbling and pass the event through to the
+ # underlying page. The event is not suppresssed.
+ if passThrough == @passThrough
+ return false
true
remove: (id = @currentId) ->
@@ -35,3 +41,5 @@ class root.HandlerStack
if handler.id == id
@stack.splice(i, 1)
break
+
+root.handlerStack = new HandlerStack