Event.cancelBubble (Property)

A flag that halts event bubbling in MSIE browsers.

Availability:

JScript - 3.0
Internet Explorer - 4.0
Opera - 5.0
Property/method value type:Boolean primitive
JavaScript syntax:IEmyEvent.cancelBubble = aBooleanValue
Argument list:aBooleanValueA true or false setting

Event propagation passes events up the DOM hierarchy, calling the handler for each event in turn. This propagation effect can be stopped at once by setting the cancelBubble property to true.

Setting this property true in an event handler may improve stability in dynamically generated HTML fragments that have mouse rollover code associated with them.

For example, you can implement a ticker in JavaScript instead of Java. However, on some MSIE implementations (Macintosh for example), the browser crashes as you rollover several objects that have been created dynamically. Using the cancelBubble technique may stop runaway events from propagating and causing contention in the browser core.

See also:Event propagation