This appendix is an easy-to-use reference that contains information about XUL elements, XBL elements, and event attributes. Details about how each element and event works within a Mozilla application are covered in the rest of the book; to learn how to use XUL or XBL, read Chapter 3 and Chapter 7.
Once you know how to use XUL and XBL, this reference allows you to look up all available tags and elements quickly. Each entry listed below includes a brief description of the element or event, its purpose, what attributes the element or event has, and what other related elements or events you can look at to get more information.
XUL isn't yet identified as a specification, and the language is still changing. The elements and attributes given here represent a stable subset of the XUL widget set. XML allows you to define new elements and attributes arbitrarily (which is partly what makes a powerful extension like XBL possible) in your markup. Although it's discouraged in practice, Mozilla application developers -- even those working on the Mozilla source itself -- often use this flexibility to manage data in one-off attributes. For example, you may find XUL buttons in the source with attributes like "loading," which is not part of the XUL specification. In fact, XBL's presence, XML's flexibility, and DOM interfaces blur the distinction between valid XUL and other XML markup. This reference tries to document all widgets in the XUL 1.0 release, any additional attributes these elements have, and their use in Mozilla application development.
All XUL elements have the attributes shown in Table C-1.
Table C-1. Common XUL element attributes
Attribute |
Description |
---|---|
align |
Specifies how child elements are aligned: baseline, center, end, start, or stretch |
allowevents |
(Boolean) Specifies whether events should be passed to the child elements |
class |
The element class of the ; often used for class-based style rules |
collapsed |
(Boolean) Specifies whether the element is collapsed or displayed; defaults to false |
container |
(Boolean) Specifies whether the element can have child elements |
containment |
Used in templates; points to RDF property represented by this XUL element |
context |
Points to the context menu that this element should use |
datasources |
Used in templates; points to the RDF data that gets processed |
debug |
Used for debugging XUL; adds borders to make the element and its layout easily visible |
dir |
Specifies the direction of the children: normal or reverse |
empty |
(Boolean) Used for template; specifies that the container has no children |
equalsize |
Specifies whether the children should be of the same size: always or never |
flex |
Provides an integer or percent value that specifies the flexibility of an element relative to its siblings within a container |
flexgroup |
Provides an integer that can group elements and give them the same degree of flexibility |
height |
Specifies an element's height |
hidden |
(Boolean) Specifies whether the element is displayed; defaults to false |
id |
A unique identifier for the element |
insertafter |
Names the ID of the element after which this element should be overlaid; this attribute works only in overlays |
insertbefore |
Names the ID of the element which this element should be overlaid before; this attribute works only in overlays |
left |
Specifies an element's position within a container in pixels to the left |
maxheight |
Specifies an element's maximum height |
maxwidth |
Specifies an element's maximum width |
minheight |
Specifies an element's minimum height |
minwidth |
Specifies an element's minimum width |
observes |
Points to a broadcasting element whose state this element observes |
ordinal |
(Integer) Specifies the element's order within the parent |
orient |
Shows the element's orientation: vertical or horizontal |
pack |
Shows how children should be distributed within this container: center, end, or start |
persist |
Shows which of the element's attributes should be persisted/stored for reuse |
position |
Shows the element's position within a list (e.g., menuitems in a menu) |
ref |
Specifies the RDF data root to begin processing (used in templates) |
style |
Provides style rules for the current element |
template |
Specifies an existing template to use for this content (used in templates) |
tooltip |
Specifies a pop up or tooltip ID to be used for this element |
tooltiptext |
Specifies text to be displayed in the element's tooltip (doesn't require a separate tooltip attribute) |
top |
Shows the current element's position within a container in pixels from the top |
uri |
Specifies the root in the XUL where content processing begins (used in templates) |
width |
Specifies an element's width |