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 |
Prev | Home | Next |
Event.cancelable | Up | Event.charCode |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |