XUL:Richlistbox

From MozillaWiki
Jump to: navigation, search

The <richlistbox> widget is supposed to be a <listbox> like widget for XUL content. It is currently implemented as a widget on its own (source) and supports only single-select mode. Multiple-select mode will come (see bug 298371), the question is however in what way.

Arguments for making <richlistbox> inherit from <listbox>

  • Less duplicate code
  • As a consequence: more stable code since it is used more frequently
  • Identical API for all kinds of listboxes
  • Consistent behavior (see e.g. bug 298993 or bug 325235)

Arguments for keeping <richlistbox> an independent widget

  • nsIDOMXULSelectControlElement's appendItem and insertItemAt methods are in their current form pretty pointless for rich content
  • the current API is pretty different from the <listbox> API - which either means breaking all current users of <richlistbox> or carrying around a lot of backwards-compatibility methods
  • while <listbox> and <richlistbox> are very similar, they still differ in details; an identical API might confuse developers more than a clearly different one
  • there would be no need to think about implementing <richlistcell>, <richlistcol>, <richlistcols>, <richlisthead> and <richlistheader>

Current Usage

The <richlistbox> widget is currently used in the following components in the Mozilla source tree:

One further notable example is the Console² extension which features its own multiple-select <richlistbox> (if you install it, you'll get FAYT in the Downloads/Extensions/Themes managers).

API References