Event bubbling (Definition)

A mechanism whereby MSIE and Netscape 6.0 pass events up a hierarchy of objects until they find a handler.

Event bubbling was introduced in version 4.0 of MSIE and provides a structured and hierarchical way of handling events. This is somewhat more object oriented in its approach than that provided by the Event Management suite in Netscape prior to version 6.

Functionally, this is very similar to the event hierarchy model found in HyperCard. Other hyper-linking and event driven systems have modelled their event handling on this same technique since it became popularized in HyperCard in 1987.

The event bubbling technique hands an event to the most specific object relating to the event, such as the object representing an HTML tag. If there is no handler, the event is passed up the document object tree until a handler that matches is found or until it is established without doubt that there is no handler.

Handlers are able to consume an event and terminate the event handling process for that event or they may choose to pass the event upwards to a parent object. This is very sub-class, super-class like behavior and is again borrowed from the HyperCard and Object Oriented prototypes.

Event bubbling has been selected as a candidate for standardization, since it is a fundamentally more useful and automated way to propagate events through the DOM. DOM level 2 documents describing an MSIE-like event model have been published and the relevant topics are included here because that event model is supported by Netscape version 6. The event model is expected to be enhanced a little at DOM level 3 when that standard matures.

See also:Element.onevent, Event, Event handler, Event management, Event model, Event object, Event propagation

insert figure 0076


Wrox Instant JavaScript - page - 55