Skip to content
Permalink
Browse files

[] (0) Define HTMLAllCollection for document.all. (Should we give it …

…the [[Class]] HTMLCollection?)

git-svn-id: http://svn.whatwg.org/webapps@3409 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Jul 14, 2009
1 parent 3d559a8 commit 7e2400ba8c2df64cc6313237c84121438547ae6e
Showing with 277 additions and 16 deletions.
  1. +130 −11 index
  2. +147 −5 source
141 index
@@ -227,9 +227,10 @@
<li><a href=#collections><span class=secno>2.8.2 </span>Collections</a>
<ol>
<li><a href=#htmlcollection><span class=secno>2.8.2.1 </span>HTMLCollection</a></li>
<li><a href=#htmlformcontrolscollection><span class=secno>2.8.2.2 </span>HTMLFormControlsCollection</a></li>
<li><a href=#htmloptionscollection><span class=secno>2.8.2.3 </span>HTMLOptionsCollection</a></li>
<li><a href=#htmlpropertycollection><span class=secno>2.8.2.4 </span>HTMLPropertyCollection</a></ol></li>
<li><a href=#htmlallcollection><span class=secno>2.8.2.2 </span>HTMLAllCollection</a></li>
<li><a href=#htmlformcontrolscollection><span class=secno>2.8.2.3 </span>HTMLFormControlsCollection</a></li>
<li><a href=#htmloptionscollection><span class=secno>2.8.2.4 </span>HTMLOptionsCollection</a></li>
<li><a href=#htmlpropertycollection><span class=secno>2.8.2.5 </span>HTMLPropertyCollection</a></ol></li>
<li><a href=#domtokenlist><span class=secno>2.8.3 </span>DOMTokenList</a></li>
<li><a href=#domsettabletokenlist><span class=secno>2.8.4 </span>DOMSettableTokenList</a></li>
<li><a href=#safe-passing-of-structured-data><span class=secno>2.8.5 </span>Safe passing of structured data</a></li>
@@ -5235,7 +5236,7 @@ a.<a href=#dom-uda-protocol title=dom-uda-protocol>protocol</a> = 'https'; // ch

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

<p>The <code><a href=#htmlcollection-0>HTMLCollection</a></code>,
<p>The <code><a href=#htmlcollection-0>HTMLCollection</a></code>, <code><a href=#htmlallcollection-0>HTMLAllCollection</a></code>,
<code><a href=#htmlformcontrolscollection-0>HTMLFormControlsCollection</a></code>,
<code><a href=#htmloptionscollection-0>HTMLOptionsCollection</a></code>, and
<code><a href=#htmlpropertycollection-0>HTMLPropertyCollection</a></code> interfaces represent various
@@ -5285,7 +5286,7 @@ interface <dfn id=htmlcollection-0>HTMLCollection</dfn> {
readonly attribute unsigned long <a href=#dom-htmlcollection-length title=dom-HTMLCollection-length>length</a>;
[IndexGetter] Element <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>(in unsigned long index);
[NameGetter] Element <a href=#dom-htmlcollection-nameditem title=dom-HTMLCollection-namedItem>namedItem</a>(in DOMString name);
<a href=#htmlcollection-0>HTMLCollection</a> <a href=#dom-htmlcollection-tags title=dom-HTMLCollection-tags>tags</a>(in DOMString tagName);
<a href=#htmlallcollection-0>HTMLAllCollection</a> <a href=#dom-htmlcollection-tags title=dom-HTMLCollection-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>
@@ -5301,7 +5302,6 @@ interface <dfn id=htmlcollection-0>HTMLCollection</dfn> {
</dd>

<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>namedItem</a></code>(<var title="">name</var>)</dt>
<dt><var title="">nodeList</var> = <var title="">collection</var> . <code title=dom-HTMLCollection-item><a href=#dom-htmlcollection-item>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>
@@ -5360,17 +5360,136 @@ interface <dfn id=htmlcollection-0>HTMLCollection</dfn> {
null.</p>

<p>The <dfn id=dom-htmlcollection-tags title=dom-HTMLCollection-tags><code>tags(<var title="">tagName</var>)</code></dfn> method must return an
<code><a href=#htmlcollection-0>HTMLCollection</a></code> rooted at the same node as the
<code><a href=#htmlallcollection-0>HTMLAllCollection</a></code> rooted at the same node as the
<code><a href=#htmlcollection-0>HTMLCollection</a></code> object on which the method was invoked,
whose filter matches only <a href=#html-elements>HTML elements</a> whose local
name is the <var title="">tagName</var> argument. In <a href=#html-documents>HTML
name is the <var title="">tagName</var> argument and that already
match the filter of the <code><a href=#htmlcollection-0>HTMLCollection</a></code> object on which
the method was invoked. In <a href=#html-documents>HTML documents</a>, the argument
must first be <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</p>

</div>


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

<p>The <code><a href=#htmlallcollection-0>HTMLAllCollection</a></code> interface represents a generic
<a href=#collections-0 title=collections>collection</a> of elements just like
<code><a href=#htmlcollection-0>HTMLCollection</a></code>, with the exception that its <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method
returns an <code><a href=#htmlcollection-0>HTMLCollection</a></code> object when there are
multiple matching elements.</p>

<!-- see notes in previous section -->
<pre class=idl>[Callable=<a href=#dom-htmlallcollection-nameditem title=dom-HTMLAllCollection-namedItem>namedItem</a>]
interface <dfn id=htmlallcollection-0>HTMLAllCollection</dfn> {
readonly attribute unsigned long <a href=#dom-htmlallcollection-length title=dom-HTMLAllCollection-length>length</a>;
[IndexGetter] Element <a href=#dom-htmlallcollection-item title=dom-HTMLAllCollection-item>item</a>(in unsigned long index);
[NameGetter] Object <a href=#dom-htmlallcollection-nameditem title=dom-HTMLAllCollection-namedItem>namedItem</a>(in DOMString name);
<a href=#htmlallcollection-0>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-HTMLAllCollection-length><a href=#dom-htmlallcollection-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-HTMLAllCollection-item><a href=#dom-htmlallcollection-item>item</a></code>(<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>
<p>Returns null if <var title="">index</var> is out of range.</p>
</dd>

<dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-item><a href=#dom-htmlallcollection-item>namedItem</a></code>(<var title="">name</var>)</dt>
<dt><var title="">collection</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-item><a href=#dom-htmlallcollection-item>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 item with ID or name <var title="">name</var> from the collection.</p>
<p>If there are multiple matching items, then an <code><a href=#htmlallcollection-0>HTMLAllCollection</a></code> object containing all those elements is returned.</p>
<p>Returns null if no element with that ID or name could be found.</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>

<dt><var title="">collection</var> = <var title="">collection</var> . <code title=dom-HTMLAllCollection-tags><a href=#dom-htmlallcollection-tags>tags</a></code>(<var title="">tagName</var>)</dt>
<dd>
<p>Returns a collection that is a filtered view of the current collection, containing only elements with the given tag name.</p>
</dd>

</dl><div class=impl>

<hr><p>The object's <span>indices of the supported indexed
properties</span> 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 <span>supported
indexed properties</span>.</p>

<p>The <dfn id=dom-htmlallcollection-length title=dom-HTMLAllCollection-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-htmlallcollection-item title=dom-HTMLAllCollection-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 <span>names of the supported named properties</span> 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-htmlallcollection-nameditem title=dom-HTMLAllCollection-namedItem><code>namedItem(<var title="">key</var>)</code></dfn> method must act according to the
following algorithm:</p>

<ol><li>

<p>Let <var title="">collection</var> be an
<code><a href=#htmlallcollection-0>HTMLAllCollection</a></code> object rooted at the same node as
the <code><a href=#htmlallcollection-0>HTMLAllCollection</a></code> object on which the method was
invoked, whose filter matches only only elements that already
match the filter of the <code><a href=#htmlallcollection-0>HTMLAllCollection</a></code> object on
which the method was invoked and that are either:</p>

<ul><li><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> elements with a <code title="">name</code>
attribute equal to <var title="">key</var>, or,</li>

<li>elements with an ID <var title="">key</var>.</li>

</ul></li>

<li>If, at the time the method is called, there is exactly one node
in <var title="">collection</var>, then return that node and stop
the algorithm.</li>

<li>Otherwise, if, at the time the method is called, <var title="">collection</var> is empty, return null and stop the
algorithm.</li>

<li>Otherwise, return <var title="">collection</var>.</li>

</ol><p>The <dfn id=dom-htmlallcollection-tags title=dom-HTMLAllCollection-tags><code>tags(<var title="">tagName</var>)</code></dfn> method must return an
<code><a href=#htmlallcollection-0>HTMLAllCollection</a></code> rooted at the same node as the
<code><a href=#htmlallcollection-0>HTMLAllCollection</a></code> object on which the method was
invoked, whose filter matches only <a href=#html-elements>HTML elements</a> whose
local name is the <var title="">tagName</var> argument and that
already match the filter of the <code><a href=#htmlallcollection-0>HTMLAllCollection</a></code>
object on which the method was invoked. In <a href=#html-documents>HTML
documents</a>, the argument must first be <a href=#converted-to-ascii-lowercase>converted to
ASCII lowercase</a>.</p>

</div>


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

<p>The <code><a href=#htmlformcontrolscollection-0>HTMLFormControlsCollection</a></code> interface represents
a <a href=#collections-0 title=collections>collection</a> of <a href=#category-listed title=category-listed>listed</a> elements in <code><a href=#the-form-element>form</a></code>
@@ -5503,7 +5622,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
--></div>


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

<p>The <code><a href=#htmloptionscollection-0>HTMLOptionsCollection</a></code> interface represents a
list of <code><a href=#the-option-element>option</a></code> elements. It is always rooted on a
@@ -5666,7 +5785,7 @@ interface <dfn id=htmloptionscollection-0>HTMLOptionsCollection</dfn> {
</ol><!-- see also http://ln.hixie.ch/?start=1161042744&count=1 --></div>


<h5 id=htmlpropertycollection><span class=secno>2.8.2.4 </span>HTMLPropertyCollection</h5>
<h5 id=htmlpropertycollection><span class=secno>2.8.2.5 </span>HTMLPropertyCollection</h5>

<p>The <code><a href=#htmlpropertycollection-0>HTMLPropertyCollection</a></code> interface represents a
<a href=#collections-0 title=collections>collection</a> of elements that add

0 comments on commit 7e2400b

Please sign in to comment.
You can’t perform that action at this time.