Mozilla XUL Element and Script Reference

Contents  Quick Reference


Specifies event handlers which the XBL element responds to. You can provide default handling which can be overriden by an appropriate handler on the bound element. When the event occurs, the code contained in the action attribute or, if the action is not present, the content of the handler tag is executed.


    <handler event="keydown" keycode="VK_F3">
      alert('You pressed the F3 key! Good for you!');


Attributes inherited from Element


The code contained in the action value is executed when the event occurs.


If set, the action is only called when the given mouse button is pressed. If this attribute is not used, it does not matter which button is pressed.



If set, the action is only called when the given character is pressed. If the key is not pressed, the event is ignored by this handler. If this attribute is not present and there is no keycode attribute, the handler is called no matter which key is pressed.


The style class of the xbl:handler. Multiple classes may be specified by separating them with spaces.


Set to the number of mouse clicks that must occur for the action to be called. For example, if set to 2, the handler only get called on a double click of the mouse. Mozilla supports values 1, 2 and 3. The default is 1.


The event that the handler listens to. When the event occurs on the bound element, the code in the action attribute is executed. Two special events exist, bindingattached, which is called when the binding is bound to an element, and bindingdetached, which is called when the binding is removed from an element.


A unique identifier so that you can identify the xbl:handler with. You can use this as a parameter to getElementById and other DOM functions and to reference the element in style sheets.


If set, the action is only called for a key event when the key with the given code is pressed.


A list of modifier keys that should be pressed to invoke the handler. Multiple keys may be separated by spaces or commas. Keys will map to other keys on platforms that do not have them.


The event phase where the handler is invoked. This should be set to the value 'capturing' to indicate during the event capturing phase or left out entirely.