Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

Widget Wrappers

Widget wrappers are objects that provide information about a widget. There are 'group' wrappers which provide information about the widget across all windows, and 'single' wrappers which provide information about a specific instance in a specific window.

Group wrapper

Methods

forWindow()

A method to obtain a single window wrapper for a widget, in the window aWindow passed as the only argument.

Properties

All of a wrapper's properties are read-only unless otherwise indicated.

Attribute Description
id the widget's ID
type the type of widget (button, view, custom). For XUL-provided widgets, this is always 'custom'
provider the provider type of the widget, id est one of PROVIDER_API or PROVIDER_XUL
instances an array of all instances (single window wrappers) of the widget. This array is NOT live.
areaType the type of the widget's current area
isGroup true, will be false for wrappers around single widget nodes
source for API-provided widgets, whether they are built-in to Firefox or add-on-provided
disabled for API-provided widgets, whether the widget is currently disabled. NB: this property is writable, and will toggle all the widgets' nodes' disabled states
label for API-provided widgets, the label of the widget
tooltiptext for API-provided widgets, the tooltip of the widget
showInPrivateBrowsing for API-provided widgets, whether the widget is visible in private browsing

Single wrapper

Properties

All of a wrapper's properties are read-only unless otherwise indicated.

Attribute Description
id the widget's ID
type the type of widget (button, view, custom). For XUL-provided widgets, this is always 'custom'
provider the provider type of the widget, id est one of PROVIDER_API or PROVIDER_XUL
node reference to the corresponding DOM node
anchor the anchor on which to anchor panels opened from this node. This will point to the overflow chevron on overflowable toolbars if and only if your widget node is overflowed, to the anchor for the panel menu if your widget is inside the panel menu, and to the node itself in all other cases
overflowed boolean indicating whether the node is currently in the overflow panel of the toolbar
isGroup false, will be true for the group widget
label for API-provided widgets, convenience getter for the label attribute of the DOM node
tooltiptext for API-provided widgets, convenience getter for the tooltiptext attribute of the DOM node
disabled for API-provided widgets, convenience getter and setter for the disabled state of this single widget. Note that you may prefer to use the group wrapper's getter/setter instead.

 

Document Tags and Contributors

 Contributors to this page: BlackYoup, GijsKruitbosch
 Last updated by: BlackYoup,