9.5. Using Commands Via the AOM

Direct use of XUL is a convenient way to implement simple commands, but it doesn't allow for imaginative designs. Such designs require scripting, and such scripts can work with several objects.

Every XUL tag in the document hierarchy can be an event target, and so every tag supports the dispatchEvent() method. Which implementation of a command is executed ultimately depends on what DOM element the dispatchEvent() method is called on.

The document object in a XUL document contains a commandDispatcher property. This property is the sole command dispatcher. It contains the UpdateCommands() method and is also used to add command updaters. The command dispatcher also provides an interface that allows the application ...

Get Rapid Application Development with Mozilla™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.