XBL

XML Binding Language (XBL, sometimes also called Extensible Bindings Language) is a language for describing bindings that can be attached to elements in other documents. The element that the binding is attached to, called the bound element, acquires the new behavior specified by the binding.

Bindings can contain event handlers that are registered on the bound element, an implementation of new methods and properties that become accessible from the bound element, and anonymous content that is inserted underneath the bound element.

Most XUL widgets are at least partially implemented using XBL. You can build your own reusable widgets from existing XUL, HTML, SVG, and other primitives using XBL.

In XUL one defines the user interface layout of an application, and then by applying "styles" one can customize the look of various different elements. The drawback is that XUL provides no means to change an element's function. For example, one might want to change how the pieces of a scroll bar work. This is where XBL comes in.

An XBL file contains "bindings", each of which describes the behavior of a XUL-widget or XML element. For example, a binding might be attached to a scroll bar. The behavior describes the properties and methods of the scroll bar and also describes the XUL elements defining the scroll bar.

The root element of an XBL file is the  element, which contains one or more   elements. Each  element declares one binding, which can be attached to any XUL element. It may also possess an  attribute. A binding is assigned to an element by setting the Mozilla CSS extension property  to the URL of the binding's file. For example:

scrollbar { -moz-binding:url('somefile.xml#binding1'); }

wherein  is the   of the binding.