Elements

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

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

<!ELEMENT content ANY>
<!ATTLIST content
   id               ID           #IMPLIED
>

The content element contains child nodes that can be in any namespace. The subtree specified by the content element is referred to as the anonymous content template. When a binding is attached and if the conditions specified by the template are met, the content element's child nodes are cloned and inserted into the bound document around the bound element. Because the nodes are hidden from their parent and exist outside the normal document tree, they are referred to as anonymous content.

  • id - The id attribute is a document-unique identifier.

children

<!ELEMENT children EMPTY>
<!ATTLIST children
   id               ID                           #IMPLIED
   includes         CDATA                        #IMPLIED
   type             (explicit|inherited)         explicit
>

The children element is used inside anonymous content to specify insertion points for explicit content that might already exist underneath the bound element or for anonymous content generated by the base binding. As far as the presentation model is concerned, any anonymous content the binding places between the bound element and the insertion point is interleaved between the bound element and its explicit children without affecting the document model.

See section 4.4 for more information.

  • id - The id attribute is a document-unique identifier.
  • includes - The includes attribute can be used to indicate that only certain content should be placed at the insertion point specified by the children element. Its value is an XPath selector as described in the XPath 1.0 specification. For the purposes of the evaluation, the bound element is treated as the context node. If the selector evaluates to anything other than a node set, it is ignored. A child can only be placed within the insertion point if it is matched by the XPath selector. Only immediate children are matched against the selector.
  • type - The type attribute can be used to indicate the type of the insertion point. There are two types of insertion points. An explicit insertion point is for the explicit children of the bound element only. An inherited insertion point is used to specify that anonymous content from the base binding can be generated and placed at the insertion point.

element

<!ELEMENT element ANY>
<!ATTLIST element
   id               ID           #IMPLIED
>

The element tag specifies the position of the bound element within the anonymous content of a binding. Normally anonymous content is generated underneath the bound element. If the element tag is used inside anonymous content it indicates the position at which the bound element should be placed relative to its anonymous content. This allows anonymous content ancestors to be generated by the binding (in addition to children).

If no element tag is specified, all anonymous content is generated underneath the bound element.

  • id - The id attribute is a document-unique identifier.

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>
<pre>&lt;!ELEMENT content ANY&gt;
&lt;!ATTLIST content
   id               ID           #IMPLIED
&gt;
</pre>
<p>The <code>content</code> element contains child nodes that can be in any namespace. The subtree specified by the <code>content</code> element is referred to as the <i>anonymous content template</i>. When a binding is attached and if the conditions specified by the template are met, the <code>content</code> element's child nodes are cloned and inserted into the bound document around the bound element. Because the nodes are hidden from their parent and exist outside the normal document tree, they are referred to as anonymous content.
</p>
<ul><li> <code><b>id</b></code> - The id attribute is a document-unique identifier.
</li></ul>
<h2 name="children">children</h2>
<pre>&lt;!ELEMENT children EMPTY&gt;
&lt;!ATTLIST children
   id               ID                           #IMPLIED
   includes         CDATA                        #IMPLIED
   type             (explicit|inherited)         explicit
&gt;
</pre>
<p>The <code>children</code> element is used inside anonymous content to specify insertion points for explicit content that might already exist underneath the bound element or for anonymous content generated by the base binding. As far as the presentation model is concerned, any anonymous content the binding places between the bound element and the insertion point is interleaved between the bound element and its explicit children without affecting the document model.
</p><p>See <a href="en/Section_4.4">section 4.4</a> for more information.
</p>
<ul><li> <code><b>id</b></code> - The <code>id</code> attribute is a document-unique identifier. 
</li><li> <code><b>includes</b></code> - The <code>includes</code> attribute can be used to indicate that only certain content should be placed at the insertion point specified by the <code>children</code> element. Its value is an XPath selector as described in the <a class="external" href="http://www.w3.org/TR/xpath.html">XPath 1.0</a> specification. For the purposes of the evaluation, the bound element is treated as the context node. If the selector evaluates to anything other than a node set, it is ignored. A child can only be placed within the insertion point if it is matched by the XPath selector. Only immediate children are matched against the selector. 
</li><li> <code><b>type</b></code> - The <code>type</code> attribute can be used to indicate the type of the insertion point. There are two types of insertion points. An <i>explicit</i> insertion point is for the explicit children of the bound element only. An <i>inherited</i> insertion point is used to specify that anonymous content from the base binding can be generated and placed at the insertion point.
</li></ul>
<h2 name="element">element</h2>
<pre>&lt;!ELEMENT element ANY&gt;
&lt;!ATTLIST element
   id               ID           #IMPLIED
&gt;
</pre>
<p>The <code>element</code> tag specifies the position of the bound element within the anonymous content of a binding. Normally anonymous content is generated underneath the bound element. If the <code>element</code> tag is used inside anonymous content it indicates the position at which the bound element should be placed relative to its anonymous content. This allows anonymous content ancestors to be generated by the binding (in addition to children).
</p><p>If no <code>element</code> tag is specified, all anonymous content is generated underneath the bound element.
</p>
<ul><li> <code><b>id</b></code> - The <code>id</code> attribute is a document-unique identifier.
</li></ul>
<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