XUL improvements in Firefox 3
Firefox 3 provides a number of new XUL elements, as well as improvements to existing elements. While this material is documented in detail elsewhere, this article provides a convenient list of these improvements as well as links to the detailed documentation.
- Numeric controls:
- The new
<scale>element lets you create sliding scales that let the user select any value in a specified range. This widget would typically be used, for example, to create a volume control.
- A new value,
number, for the
typeattribute of textboxes creates a textbox in which only numbers may be entered. In addition, arrow buttons appear to one side which may be used to step through values. More information about numeric textboxes. (bug 345510)
<spinbuttons>element is added which can be used when creating widgets using XBL bindings. (bug 155053)
- Two widgets,
<timepicker>, can be used to allow the entry of dates and times. The datepicker is available in a number of styles by setting the
typeattribute, to allow entry with textboxes or a calendar grid. More information about date pickers Datepicker Reference Timepicker Reference
- The new
- A guide has been created for menus and popups describing new features available:
<dropmarker>element is added which is useful when creating menu-like widgets using XBL bindings. (bug 348614)
<panel>element is new and designed for popups that are not menus. They can support any type of content. The <menupopup> element should be used for menus. Menus provide keyboard navigation and support opening and closing submenus.
- Trees can now be scrolled horizontally. If the columns don't fit into the available width, a horizontal scrollbar appears. This happens if the columns' specified widths add up to more than the available space. See bug 212789 for details.
- A new selection style allows cells to be selected individually, instead of entire rows. To use this selection style, set the tree's
- Trees now support editing of individual cells. When the user double-clicks an editable cell, a text field appears in which the user can edit the contents of the cell. See these notes for details.
- <treecol> elements now support an
overflowattribute which may be set to true to allow the text of cells within that column to expand to neighboring blank cells if the text is too large to fit into that single cell.
imageattribute is now used consistently for setting images.
- Menulists fire the
selectevent when selecting an item.
editableproperties have been added to menulist
<menuseparator>elements now have a readonly
selectedproperty which retrieves whether the item is selected in a <menulist>
<menuseparator>elements now have a readonly
controlproperty which returns the enclosing <menulist>
<menuseparator>elements now support the
labelproperties which set the corresponding attribute
- The <menu> element now has methods to append, insert and remove menuitems. (bug 372552)
- Editable menulists now offer an
editorproperty to get the internal
nsIEditorfor its text field.
- Menus may now be made translucent on platforms that support it (bug 70798).
- Setting a textbox's
trueenables inline spellchecking for that textbox.
<textbox>now has a
reset()method to reset the value of the textbox to the default value. The
defaultValueproperty may be used to retrieve and modify the default value of the textbox.
editorproperty is now offered, which lets you get the internal
nsIEditorfor the text field.
textboxnow supports a
newlinesattribute which specifies how line breaks in pasted text are handled. Possible values are:
pasteintact- paste everything as is
pastetofirst- (default value) paste only up to the first line break
replacewithspaces- replace line breaks with spaces
replacewithcommas- replace line breaks with commas
strip- strip out all line breaks
stripsurroundingwhitespace- strip out all line breaks and surrounding whitespace
typeattribute on a
<button>may be set to
repeatto create buttons which fire their command event repeatedly while the mouse button is held down.
buttondisabledacceptattribute can now be used on the
<dialog>element to have the accept (OK) button initially disabled.
<titlebar>element now supports the
alloweventsattribute to allow events to be passed to the children of the titlebar.
<splitter>now supports an additional value for the
'both'which indicates that the splitter can collapse elements on both sides of it when dragged. The
substateattribute will set to either before or after when one is collapsed. (bug 337955)
<richlistbox>element now supports multiple selection. Set the
'multiple'to enable this.
<radio>element has a
groupattribute which may be set to the id of a
<radiogroup>element which the radio button belongs to. This allows the radio buttons to arranged in a manner that may not be as suitable when placing them all inside a radiogroup.
- Menus, panels and tooltips support two additional methods,
openPopupAtScreen(). These methods should be used instead of
showPopup()which was found to be confusing to use.
- Handling of the
<key>element improved for non-Latin keyboard layout users. See Gecko Keypress Event.
- On Mac OS X, the activetitlebarcolor and inactivetitlebarcolor attributes of the root elements (
<wizard>) are available to customize the color of the windows' title bars.