Elements

  • Revision slug: XBL/XBL_1.0_Reference/Elements
  • Revision title: Elements
  • Revision id: 41778
  • Created:
  • Creator: Tservo
  • Is current revision? No
  • Comment /* binding */

Revision Content

bindings

<!ENTITY % bindings-content "(binding|script|stylesheet)*">
<!ELEMENT bindings %bindings-content;>
<!ATTLIST bindings
   id               ID           #IMPLIED
   type             CDATA        #IMPLIED
>

The bindings element is the root element of an XBL document. It contains zero or more binding elements as children. Each binding child element defines a unique binding that can be attached to elements in other documents. The bindings element can also contain script and stylesheet elements as children. These specify scripts and stylesheets that are used by the bindings.

<bindings xmlns="http://www.mozilla.org/xbl">
  <binding id="binding1">
    ...
  </binding>
  <binding id="binding2">
    ...
  </binding>
  ...
</bindings>
  • id - The id attribute is a document-unique identifier. The value of this identifier is often used to manipulate the element through a DOM interface (e.g., using document.getElementById).
  • type - The type attribute specifies the scripting language used by all bindings in the document. Bindings can selectively override this default by specifying type attributes of their own.

binding

<!ENTITY % binding-content "(content?,implementation?,handlers?)">
<!ELEMENT binding %binding-content;>
<!ATTLIST binding
   id                     ID             #REQUIRED
   extends                CDATA          #IMPLIED
   display                CDATA          #IMPLIED
   applyauthorstyles      false          #IMPLIED
   styleexplicitcontent   false          #IMPLIED
>

The binding element describes a single XBL binding that dynamically binds new information to XML elements in other documents. Each binding has three optional components.

  • Content - A binding can specify new content that is placed around the bound element. This content is anonymous and is hidden from the bound element's DOM.
  • Methods and Properties - A binding can specify additional methods that can be invoked on the element. It can also specify additional properties that can be retrieved or set on the element. In this way the functionality of the bound element becomes extensible.
  • Behavior - A binding can specify event handlers for specific actions like key and mouse events that can make use of the new functionality applied in the binding.
  • id - The id attribute is a document-unique identifier. For the binding element, this attribute is required, since it is used to uniquely identify a binding.
  • extends - The extends attribute is used to specify the URL of a binding that this binding inherits from. The URL specifies a particular binding document. The # notation must be used to point to a specific binding id within a binding document.
  • applyauthorstyles - The applyauthorstyles attribute indicates whether or not rules in author style sheets associated with the bound element's document apply to the anonymous content generated by the binding. If omitted, a value of false is assumed. See section 4.6 for more information.
  • styleexplicitcontent - The styleexplicitcontent attribute indicates whether or not style sheets loaded from an XBL document are applied to a bound element's explicit children (in addition to the bound element itself). If omitted, a value of false is assumed. See section 4.6 for more information.

content

children

element

implementation

method

parameter

body

property

getter

setter

handlers

handler

script

stylesheet

Revision Source

<p>
</p>
<h2 name="bindings">bindings</h2>
<pre>&lt;!ENTITY % bindings-content "(binding|script|stylesheet)*"&gt;
&lt;!ELEMENT bindings %bindings-content;&gt;
&lt;!ATTLIST bindings
   id               ID           #IMPLIED
   type             CDATA        #IMPLIED
&gt;
</pre>
<p>The <code>bindings</code> element is the root element of an XBL document. It contains zero or more <code>binding</code> elements as children. Each <code>binding</code> child element defines a unique binding that can be attached to elements in other documents. The <code>bindings</code> element can also contain <code>script</code> and <code>stylesheet</code> elements as children. These specify scripts and stylesheets that are used by the bindings.
</p>
<pre>&lt;bindings xmlns="http://www.mozilla.org/xbl"&gt;
  &lt;binding id="binding1"&gt;
    ...
  &lt;/binding&gt;
  &lt;binding id="binding2"&gt;
    ...
  &lt;/binding&gt;
  ...
&lt;/bindings&gt;
</pre>
<ul><li> <code><b>id</b></code> - The <code>id</code> attribute is a document-unique identifier. The value of this identifier is often used to manipulate the element through a DOM interface (e.g., using <code>document.getElementById</code>). 
</li><li> <code><b>type</b></code> - The <code>type</code> attribute specifies the scripting language used by all bindings in the document. Bindings can selectively override this default by specifying <code>type</code> attributes of their own.
</li></ul>
<h2 name="binding">binding</h2>
<pre>&lt;!ENTITY % binding-content "(content?,implementation?,handlers?)"&gt;
&lt;!ELEMENT binding %binding-content;&gt;
&lt;!ATTLIST binding
   id                     ID             #REQUIRED
   extends                CDATA          #IMPLIED
   display                CDATA          #IMPLIED
   applyauthorstyles      false          #IMPLIED
   styleexplicitcontent   false          #IMPLIED
&gt;
</pre>
<p>The <code>binding</code> element describes a single XBL binding that dynamically binds new information to XML elements in other documents. Each binding has three optional components.
</p>
<ul><li> <i>Content</i> - A binding can specify new content that is placed around the bound element. This content is anonymous and is hidden from the bound element's DOM.
</li><li> <i>Methods and Properties</i> - A binding can specify additional methods that can be invoked on the element. It can also specify additional properties that can be retrieved or set on the element. In this way the functionality of the bound element becomes extensible.
</li><li> <i>Behavior</i> - A binding can specify event handlers for specific actions like key and mouse events that can make use of the new functionality applied in the binding.
</li></ul>
<ul><li> <code><b>id</b></code> - The <code>id</code> attribute is a document-unique identifier. For the binding element, this attribute is required, since it is used to uniquely identify a binding. 
</li><li> <code><b>extends</b></code> - The <code>extends</code> attribute is used to specify the URL of a binding that this binding inherits from. The URL specifies a particular binding document. The # notation must be used to point to a specific binding <code>id</code> within a binding document. 
</li><li> <code><b>applyauthorstyles</b></code> - The <code>applyauthorstyles</code> attribute indicates whether or not rules in author style sheets associated with the bound element's document apply to the anonymous content generated by the binding. If omitted, a value of <code>false</code> is assumed. See <a href="en/Section_4.6">section 4.6</a> for more information. 
</li><li> <code><b>styleexplicitcontent</b></code> - The <code>styleexplicitcontent</code> attribute indicates whether or not style sheets loaded from an XBL document are applied to a bound element's explicit children (in addition to the bound element itself). If omitted, a value of <code>false</code> is assumed. See <a href="en/Section_4.6">section 4.6</a> for more information.
</li></ul>
<h2 name="content">content</h2>
<h2 name="children">children</h2>
<h2 name="element">element</h2>
<h2 name="implementation">implementation</h2>
<h2 name="method">method</h2>
<h2 name="parameter">parameter</h2>
<h2 name="body">body</h2>
<h2 name="property">property</h2>
<h2 name="getter">getter</h2>
<h2 name="setter">setter</h2>
<h2 name="handlers">handlers</h2>
<h2 name="handler">handler</h2>
<h2 name="script">script</h2>
<h2 name="stylesheet">stylesheet</h2>
Revert to this revision