O'Reilly logo

Rapid Application Development with Mozilla™ by Nigel McFarlane

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.6. Debug Corner: Detecting Events

Detecting events is a trivial process in Mozilla.

First, ensure that you have the preference browser.dom.window.dump.enabled set to true. Start the platform with the -console option. Second, write a one-line diagnostic function:

function edump(e) { dump(e.type+":"+e.target.tagName); }

Third, install this function as a handler on the window object for every event that interests you. Install it via addEventListener() if you want to see the events during the capture phase as well. Finally, start the browser from the command line, and watch the flood of events appear in that command-line window as you click and type.

To diagnose broadcast events, install handlers for the oncommand event, or just add diagnostic ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required