mirror of
https://github.com/atom/atom.git
synced 2026-02-17 18:11:29 -05:00
Handle .stopPropagation() being called on command events
This commit is contained in:
@@ -16,11 +16,14 @@ class CommandRegistry
|
||||
@listenersByCommandName[commandName].push(new CommandListener(selector, callback))
|
||||
|
||||
dispatchCommand: (event) =>
|
||||
propagationStopped = false
|
||||
currentTarget = event.target
|
||||
|
||||
syntheticEvent = Object.create event,
|
||||
eventPhase: value: Event.BUBBLING_PHASE
|
||||
currentTarget: get: -> currentTarget
|
||||
stopPropagation: value: -> propagationStopped = true
|
||||
|
||||
currentTarget = event.target
|
||||
loop
|
||||
matchingListeners =
|
||||
@listenersByCommandName[event.type]
|
||||
@@ -30,6 +33,7 @@ class CommandRegistry
|
||||
for listener in matchingListeners
|
||||
listener.callback.call(currentTarget, syntheticEvent)
|
||||
|
||||
break if propagationStopped
|
||||
break if currentTarget is @rootNode
|
||||
currentTarget = currentTarget.parentNode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user