ember.js - Does an event handled in a child view bubbles up to the parent's one? -
if event triggered on child view, handled not in child in parent?
this ember view test:
test("event manager should able re-dispatch events view", function() { var receivedevent=0; view = ember.containerview.createwithmixins({ elementid: 'containerview', eventmanager: ember.object.create({ mousedown: function(evt, view) { // re-dispatch event when it. // // second parameter tells dispatcher // event has been handled. // api need reworked since // multiple eventmanagers in single view // hierarchy break, shows // re-dispatching works view.$().trigger('mousedown',this); } }), childviews: ['child'], child: ember.view.extend({ elementid: 'nestedview', mousedown: function(evt) { receivedevent++; } }), mousedown: function(evt) { receivedevent++; } }); ember.run(function() { view.append(); }); ember.$('#nestedview').trigger('mousedown'); equal(receivedevent, 2, "event should go manager , not view"); });
my question is: why receivedevent
2, not 1? what's order of event handling? shouldn't child view stop event propagation?