I'm trying to wrap my head around the general workings and principles of event dispatching in event-driven (sub-)systems.Although I have used it on quite a few occasions in for instance Javascript, Flash (Actionscript 2 and 3) and have even made a simple event dispatching system in PHP for myself at one time, I've never really understood event bubbling and/or propagation that well.First question:Is event bubbling synonym to event propagation?Second question:Am I correct in my understanding that when an event bubbles, this means that it gets moved up the hierarchy of objects?Third and most important question:If my understanding in question 2 is correct; how is this moving up the hierarchy of objects generally implemented?Does it generally mean that the parent object redispatches the same event to its parent (until it reaches the root object)? And if so; do all these objects in the hierarchy need to listen to their children for these events, or am I missing something vital principle in my understanding about event bubbling, where there's no need to let parent object register them selfs as listeners of child object events?If you could illustrate these basic principles by means of some simple pseudo code, I'd be more than grateful.
How does event bubbling generally work and is it synonym to event propagation?
language agnostic;event programming
First question: Is event bubbling synonym to event propagation?No. Bubbling is a form of event propagation, but it can't be used as a synonym. Propagation is a general term for passing an event around. Bubbling is a specific strategy of event propagation.Second question: Am I correct in my understanding that when an event  bubbles, this means that it gets moved up the hierarchy of  objects?Yes. Bubbling means it goes up the hierarchy, as opposed to tunneling, which means it goes from the top element down or routing, which means the next object to receive the event can be anything you choose. Third and most important question: If my understanding in question 2  is correct; how is this moving up the hierarchy of objects generally  implemented?Pretty easy. In your visual hierarchy the controls have a reference to their parent/their top level visual or can obtain it somewhere. So when they capture an event, they just notify its parent about it, which notifies its parent about it etc.Pseudo Code is like this for any UI control:OnEvent(SomeEvent event){   CallHandlersForEvent(event);   if(HasParent && event.ContinueBubbling == true)   {       Parent.OnEvent(event);   }}Like blueberryfields said it needn't be the direct parent who receives the event next. You could implement like this, too:OnEvent(SomeEvent event){    CallHandlersForEvent(event);    NextControl = VisualTree.GetVisualParent(this);    if(NextControl != null && event.ContinueBubbling == true)    {       NextControl.OnEvent(event);    }}