Skip to content

Commit

Permalink
[e] (0) Move HTMLCollection to DOM Core
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@6327 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 26, 2011
1 parent 268aabe commit a30f26d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 385 deletions.
153 changes: 24 additions & 129 deletions complete.html
Expand Up @@ -370,11 +370,10 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
<li><a href=#reflecting-content-attributes-in-idl-attributes><span class=secno>2.8.1 </span>Reflecting content attributes in IDL attributes</a></li>
<li><a href=#collections-0><span class=secno>2.8.2 </span>Collections</a>
<ol>
<li><a href=#htmlcollection-0><span class=secno>2.8.2.1 </span>HTMLCollection</a></li>
<li><a href=#htmlallcollection-0><span class=secno>2.8.2.2 </span>HTMLAllCollection</a></li>
<li><a href=#htmlformcontrolscollection-0><span class=secno>2.8.2.3 </span>HTMLFormControlsCollection</a></li>
<li><a href=#htmloptionscollection-0><span class=secno>2.8.2.4 </span>HTMLOptionsCollection</a></li>
<li><a href=#htmlpropertiescollection-0><span class=secno>2.8.2.5 </span>HTMLPropertiesCollection</a></ol></li>
<li><a href=#htmlallcollection-0><span class=secno>2.8.2.1 </span>HTMLAllCollection</a></li>
<li><a href=#htmlformcontrolscollection-0><span class=secno>2.8.2.2 </span>HTMLFormControlsCollection</a></li>
<li><a href=#htmloptionscollection-0><span class=secno>2.8.2.3 </span>HTMLOptionsCollection</a></li>
<li><a href=#htmlpropertiescollection-0><span class=secno>2.8.2.4 </span>HTMLPropertiesCollection</a></ol></li>
<li><a href=#domtokenlist-0><span class=secno>2.8.3 </span>DOMTokenList</a></li>
<li><a href=#domsettabletokenlist-0><span class=secno>2.8.4 </span>DOMSettableTokenList</a></li>
<li><a href=#domstringmap-0><span class=secno>2.8.5 </span>DOMStringMap</a></li>
Expand Down Expand Up @@ -3520,6 +3519,8 @@ <h4 id=dependencies><span class=secno>2.2.2 </span>Dependencies</h4>
<li><dfn id=processinginstruction><code>ProcessingInstruction</code></dfn> interface</li>
<li><dfn id=text><code>Text</code></dfn> interface</li>

<li><dfn id=htmlcollection><code>HTMLCollection</code></dfn> interface, and the terms <dfn id=collections>collections</dfn> and <dfn id=represented-by-the-collection>represented by the collection</dfn></li>

<li><dfn id=dom-domimplementation-createdocument title=dom-DOMImplementation-createDocument><code>createDocument()</code></dfn> method</li>
<li><dfn id=dom-document-createelement title=dom-Document-createElement><code>createElement()</code></dfn> method</li>
<li><dfn id=dom-document-createelementns title=dom-Document-createElementNS><code>createElementNS()</code></dfn> method</li>
Expand Down Expand Up @@ -7878,123 +7879,17 @@ <h4 id=reflecting-content-attributes-in-idl-attributes><span class=secno>2.8.1 <

<h4 id=collections-0><span class=secno>2.8.2 </span>Collections</h4>

<p>The <code><a href=#htmlcollection>HTMLCollection</a></code>, <code><a href=#htmlallcollection>HTMLAllCollection</a></code>,
<p>The <code><a href=#htmlallcollection>HTMLAllCollection</a></code>,
<code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code>,
<code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code>,
<!--MD-->
and <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code>
<!--MD-->
interfaces represent various
lists of DOM nodes. Collectively, objects implementing these
interfaces are called <dfn id=collections>collections</dfn>.</p>

<p>When a <a href=#collections title=collections>collection</a> is created, a
filter and a root are associated with the collection.</p>

<p class=example>For example, when the <code><a href=#htmlcollection>HTMLCollection</a></code>
object for the <code title=dom-document-images><a href=#dom-document-images>document.images</a></code> attribute is
created, it is associated with a filter that selects only
<code><a href=#the-img-element>img</a></code> elements, and rooted at the root of the
document.</p>

<p>The <a href=#collections title=collections>collection</a> then <dfn id=represented-by-the-collection title="represented by the collection">represents</dfn> a
<a href=#live>live</a> view of the subtree rooted at the collection's
root, containing only nodes that match the given filter. The view is
linear. <span class=impl>In the absence of specific requirements
to the contrary, the nodes within the collection must be sorted in
<a href=#tree-order>tree order</a>.</span></p>

<div class=impl>

<p class=note>The <code title=dom-table-rows><a href=#dom-table-rows>rows</a></code> list is
not in tree order.</p>

<p>An attribute that returns a collection must return the same
object every time it is retrieved.</p>

</div>


<h5 id=htmlcollection-0><span class=secno>2.8.2.1 </span>HTMLCollection</h5>

<p>The <code><a href=#htmlcollection>HTMLCollection</a></code> interface represents a generic
<a href=#collections title=collections>collection</a> of elements.</p>

<pre class=idl>interface <dfn id=htmlcollection>HTMLCollection</dfn> {
readonly attribute unsigned long <a href=#dom-htmlcollection-length title=dom-HTMLCollection-length>length</a>;
caller getter <a href=#element>Element</a>? <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>(in unsigned long index);
caller getter object? <a href=#dom-htmlcollection-nameditem title=dom-HTMLCollection-namedItem>namedItem</a>(in DOMString name); // only returns Element
};</pre>

<dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length><a href=#dom-htmlcollection-length>length</a></code></dt>
<dd>
<p>Returns the number of elements in the collection.</p>
</dd>

<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
<dt><var title="">collection</var>[<var title="">index</var>]</dt>
<dt><var title="">collection</var>(<var title="">index</var>)</dt>
<dd>
<p>Returns the item with index <var title="">index</var> from the collection. The items are sorted in <a href=#tree-order>tree order</a>.</p>
</dd>

<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-namedItem><a href=#dom-htmlcollection-nameditem>namedItem</a></code>(<var title="">name</var>)</dt>
<dt><var title="">collection</var>[<var title="">name</var>]</dt>
<dt><var title="">collection</var>(<var title="">name</var>)</dt>
<dd>
<p>Returns the first item with <a href=#concept-id title=concept-id>ID</a> or name <var title="">name</var>
from the collection.</p>
<p>Only <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>,
<code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>,
<code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, and
<code><a href=#the-object-element>object</a></code> elements can have a name for the purpose of
this method; their name is given by the value of their <code title="">name</code> attribute.</p>
</dd>
</dl><div class=impl>

<p>The object's <a href=#supported-property-indices>supported property indices</a> are the
numbers in the range zero to one less than the number of nodes
<a href=#represented-by-the-collection>represented by the collection</a>. If there are no such
elements, then there are no <a href=#supported-property-indices>supported property
indices</a>.</p>

<p>The <dfn id=dom-htmlcollection-length title=dom-HTMLCollection-length><code>length</code></dfn>
attribute must return the number of nodes <a href=#represented-by-the-collection>represented by the
collection</a>.</p>

<p>The <dfn id=dom-htmlcollection-item title=dom-HTMLCollection-item><code>item(<var title="">index</var>)</code></dfn> method must return the <var title="">index</var>th node in the collection. If there is no <var title="">index</var>th node in the collection, then the method must
return null.</p>

<p>The <a href=#supported-property-names>supported property names</a> consist
of the values of the <code title="">name</code> attributes of each
<code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>, <code><a href=#the-area-element>area</a></code>,
<code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>, <code><a href=#frame>frame</a></code>,
<code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, and
<code><a href=#the-object-element>object</a></code> element <a href=#represented-by-the-collection>represented by the
collection</a> with a <code title="">name</code> attribute, plus
the list of IDs that the elements <a href=#represented-by-the-collection>represented by the
collection</a> have.</p>

<p>The <dfn id=dom-htmlcollection-nameditem title=dom-HTMLCollection-namedItem><code>namedItem(<var title="">key</var>)</code></dfn> method must return the first node
in the collection that matches either of the following
requirements:</p>

<ul><li>It is an <code><a href=#the-a-element>a</a></code>, <code><a href=#the-applet-element>applet</a></code>,
<code><a href=#the-area-element>area</a></code>, <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-form-element>form</a></code>,
<code><a href=#frame>frame</a></code>, <code><a href=#frameset>frameset</a></code>, <code><a href=#the-iframe-element>iframe</a></code>,
<code><a href=#the-img-element>img</a></code>, or <code><a href=#the-object-element>object</a></code> element with a <code title="">name</code> attribute equal to <var title="">key</var>,
or,</li>

<li>It is an element with an <a href=#concept-id title=concept-id>ID</a>
equal to <var title="">key</var>.</li>

</ul><p>If no such elements are found, then the method must return
null.</p>

</div>
interfaces are <a href=#collections>collections</a> derived from the
<code><a href=#htmlcollection>HTMLCollection</a></code> interface.</p>


<h5 id=htmlallcollection-0><span class=secno>2.8.2.2 </span>HTMLAllCollection</h5>
<h5 id=htmlallcollection-0><span class=secno>2.8.2.1 </span>HTMLAllCollection</h5>

<p>The <code><a href=#htmlallcollection>HTMLAllCollection</a></code> interface represents a generic
<a href=#collections title=collections>collection</a> of elements just like
Expand All @@ -8003,17 +7898,17 @@ <h5 id=htmlallcollection-0><span class=secno>2.8.2.2 </span>HTMLAllCollection</h
multiple matching elements.</p>

<pre class=idl>interface <dfn id=htmlallcollection>HTMLAllCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
// inherits <a href=#dom-htmlcollection-length title=dom-HTMLCollection-length>length</a> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
// inherits <span title=dom-HTMLCollection-length>length</span> and <span title=dom-HTMLCollection-item>item</span>()
caller getter object? <a href=#dom-htmlallcollection-nameditem title=dom-HTMLAllCollection-namedItem>namedItem</a>(in DOMString name); // overrides inherited namedItem()
<a href=#htmlallcollection>HTMLAllCollection</a> <a href=#dom-htmlallcollection-tags title=dom-HTMLAllCollection-tags>tags</a>(in DOMString tagName);
};</pre>

<dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length><a href=#dom-htmlcollection-length>length</a></code></dt>
<dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length>length</code></dt>
<dd>
<p>Returns the number of elements in the collection.</p>
</dd>

<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item>item</code>(<var title="">index</var>)</dt>
<dt><var title="">collection</var>[<var title="">index</var>]</dt>
<dt><var title="">collection</var>(<var title="">index</var>)</dt>
<dd>
Expand Down Expand Up @@ -8090,27 +7985,27 @@ <h5 id=htmlallcollection-0><span class=secno>2.8.2.2 </span>HTMLAllCollection</h
</div>


<h5 id=htmlformcontrolscollection-0><span class=secno>2.8.2.3 </span>HTMLFormControlsCollection</h5>
<h5 id=htmlformcontrolscollection-0><span class=secno>2.8.2.2 </span>HTMLFormControlsCollection</h5>

<p>The <code><a href=#htmlformcontrolscollection>HTMLFormControlsCollection</a></code> interface represents
a <a href=#collections title=collections>collection</a> of <a href=#category-listed title=category-listed>listed elements</a> in <code><a href=#the-form-element>form</a></code>
and <code><a href=#the-fieldset-element>fieldset</a></code> elements.</p>

<pre class=idl>interface <dfn id=htmlformcontrolscollection>HTMLFormControlsCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
// inherits <a href=#dom-htmlcollection-length title=dom-HTMLCollection-length>length</a> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
// inherits <span title=dom-HTMLCollection-length>length</span> and <span title=dom-HTMLCollection-item>item</span>()
caller getter object? <a href=#dom-htmlformcontrolscollection-nameditem title=dom-HTMLFormControlsCollection-namedItem>namedItem</a>(in DOMString name); // overrides inherited namedItem()
};

interface <dfn id=radionodelist>RadioNodeList</dfn> : <a href=#nodelist>NodeList</a> {
attribute DOMString <a href=#dom-radionodelist-value title=dom-RadioNodeList-value>value</a>;
};</pre>

<dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length><a href=#dom-htmlcollection-length>length</a></code></dt>
<dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length>length</code></dt>
<dd>
<p>Returns the number of elements in the collection.</p>
</dd>

<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item>item</code>(<var title="">index</var>)</dt>
<dt><var title="">collection</var>[<var title="">index</var>]</dt>
<dt><var title="">collection</var>(<var title="">index</var>)</dt>
<dd>
Expand Down Expand Up @@ -8204,15 +8099,15 @@ <h5 id=htmlformcontrolscollection-0><span class=secno>2.8.2.3 </span>HTMLFormCon
--></div>


<h5 id=htmloptionscollection-0><span class=secno>2.8.2.4 </span>HTMLOptionsCollection</h5>
<h5 id=htmloptionscollection-0><span class=secno>2.8.2.3 </span>HTMLOptionsCollection</h5>

<p>The <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> interface represents a
list of <code><a href=#the-option-element>option</a></code> elements. It is always rooted on a
<code><a href=#the-select-element>select</a></code> element and has attributes and methods that
manipulate that element's descendants.</p>

<pre class=idl>interface <dfn id=htmloptionscollection>HTMLOptionsCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
// inherits <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
// inherits <span title=dom-HTMLCollection-item>item</span>()
attribute unsigned long <a href=#dom-htmloptionscollection-length title=dom-HTMLOptionsCollection-length>length</a>; // overrides inherited length
caller getter object? <a href=#dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem>namedItem</a>(in DOMString name); // overrides inherited namedItem()
void <a href=#dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in optional <a href=#htmlelement>HTMLElement</a>? before);
Expand All @@ -8228,7 +8123,7 @@ <h5 id=htmloptionscollection-0><span class=secno>2.8.2.4 </span>HTMLOptionsColle
<p>When set to a greater number, adds new blank <code><a href=#the-option-element>option</a></code> elements to that container.</p>
</dd>

<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item>item</code>(<var title="">index</var>)</dt>
<dt><var title="">collection</var>[<var title="">index</var>]</dt>
<dt><var title="">collection</var>(<var title="">index</var>)</dt>
<dd>
Expand Down Expand Up @@ -8380,15 +8275,15 @@ <h5 id=htmloptionscollection-0><span class=secno>2.8.2.4 </span>HTMLOptionsColle
<!--MD-->
<div data-component="HTML Microdata (editor: Ian Hickson)">

<h5 id=htmlpropertiescollection-0><span class=secno>2.8.2.5 </span>HTMLPropertiesCollection</h5>
<h5 id=htmlpropertiescollection-0><span class=secno>2.8.2.4 </span>HTMLPropertiesCollection</h5>

<p>The <code><a href=#htmlpropertiescollection>HTMLPropertiesCollection</a></code> interface represents a
<a href=#collections title=collections>collection</a> of elements that add
name-value pairs to a particular <a href=#concept-item title=concept-item>item</a> in the <a href=#microdata>microdata</a>
model.</p>

<pre class=idl>interface <dfn id=htmlpropertiescollection>HTMLPropertiesCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
// inherits <a href=#dom-htmlcollection-length title=dom-HTMLCollection-length>length</a> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>()
// inherits <span title=dom-HTMLCollection-length>length</span> and <span title=dom-HTMLCollection-item>item</span>()
caller getter <a href=#propertynodelist>PropertyNodeList</a>? <a href=#dom-htmlpropertiescollection-nameditem title=dom-HTMLPropertiesCollection-namedItem>namedItem</a>(in DOMString name); // overrides inherited namedItem()
readonly attribute <span>DOMStringList</span> <a href=#dom-htmlpropertiescollection-names title=dom-HTMLPropertiesCollection-names>names</a>;
};
Expand All @@ -8399,12 +8294,12 @@ <h5 id=htmlpropertiescollection-0><span class=secno>2.8.2.5 </span>HTMLPropertie
<a href=#propertyvaluearray>PropertyValueArray</a> <a href=#dom-propertynodelist-getvalues title=dom-PropertyNodeList-getValues>getValues</a>();
};</pre>

<dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length><a href=#dom-htmlcollection-length>length</a></code></dt>
<dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLCollection-length>length</code></dt>
<dd>
<p>Returns the number of elements in the collection.</p>
</dd>

<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item>item</code>(<var title="">index</var>)</dt>
<dt><var title="">collection</var>[<var title="">index</var>]</dt>
<dt><var title="">collection</var>(<var title="">index</var>)</dt>
<dd>
Expand Down

0 comments on commit a30f26d

Please sign in to comment.