[html5] r3409 - [] (0) Define HTMLAllCollection for document.all. (Should we give it the [[Class [...]
whatwg at whatwg.org
whatwg at whatwg.org
Tue Jul 14 00:21:38 PDT 2009
Author: ianh
Date: 2009-07-14 00:21:37 -0700 (Tue, 14 Jul 2009)
New Revision: 3409
Modified:
index
source
Log:
[] (0) Define HTMLAllCollection for document.all. (Should we give it the [[Class]] HTMLCollection?)
Modified: index
===================================================================
--- index 2009-07-14 06:33:40 UTC (rev 3408)
+++ index 2009-07-14 07:21:37 UTC (rev 3409)
@@ -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 @@
<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 @@
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 @@
</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 @@
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 @@
--></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 @@
</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
Modified: source
===================================================================
--- source 2009-07-14 06:33:40 UTC (rev 3408)
+++ source 2009-07-14 07:21:37 UTC (rev 3409)
@@ -4950,7 +4950,7 @@
<h4>Collections</h4>
- <p>The <code>HTMLCollection</code>,
+ <p>The <code>HTMLCollection</code>, <code>HTMLAllCollection</code>,
<code>HTMLFormControlsCollection</code>,
<code>HTMLOptionsCollection</code>, and
<code>HTMLPropertyCollection</code> interfaces represent various
@@ -5002,7 +5002,7 @@
readonly attribute unsigned long <span title="dom-HTMLCollection-length">length</span>;
[IndexGetter] Element <span title="dom-HTMLCollection-item">item</span>(in unsigned long index);
[NameGetter] Element <span title="dom-HTMLCollection-namedItem">namedItem</span>(in DOMString name);
- <span>HTMLCollection</span> <span title="dom-HTMLCollection-tags">tags</span>(in DOMString tagName);
+ <span>HTMLAllCollection</span> <span title="dom-HTMLCollection-tags">tags</span>(in DOMString tagName);
};</pre>
<dl class="domintro">
@@ -5020,7 +5020,6 @@
</dd>
<dt><var title="">element</var> = <var title="">collection</var> . <code title="dom-HTMLCollection-item">namedItem</code>(<var title="">name</var>)</dt>
- <dt><var title="">nodeList</var> = <var title="">collection</var> . <code title="dom-HTMLCollection-item">namedItem</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>
@@ -5096,10 +5095,153 @@
<p>The <dfn title="dom-HTMLCollection-tags"><code>tags(<var
title="">tagName</var>)</code></dfn> method must return an
- <code>HTMLCollection</code> rooted at the same node as the
+ <code>HTMLAllCollection</code> rooted at the same node as the
<code>HTMLCollection</code> object on which the method was invoked,
whose filter matches only <span>HTML elements</span> whose local
- name is the <var title="">tagName</var> argument. In <span>HTML
+ name is the <var title="">tagName</var> argument and that already
+ match the filter of the <code>HTMLCollection</code> object on which
+ the method was invoked. In <span>HTML documents</span>, the argument
+ must first be <span>converted to ASCII lowercase</span>.</p>
+
+ </div>
+
+
+ <h5>HTMLAllCollection</h5>
+
+ <p>The <code>HTMLAllCollection</code> interface represents a generic
+ <span title="collections">collection</span> of elements just like
+ <code>HTMLCollection</code>, with the exception that its <code
+ title="dom-HTMLAllCollection-namedItem">namedItem()</code> method
+ returns an <code>HTMLCollection</code> object when there are
+ multiple matching elements.</p>
+
+ <!-- see notes in previous section -->
+ <pre class="idl">[Callable=<span title="dom-HTMLAllCollection-namedItem">namedItem</span>]
+interface <dfn>HTMLAllCollection</dfn> {
+ readonly attribute unsigned long <span title="dom-HTMLAllCollection-length">length</span>;
+ [IndexGetter] Element <span title="dom-HTMLAllCollection-item">item</span>(in unsigned long index);
+ [NameGetter] Object <span title="dom-HTMLAllCollection-namedItem">namedItem</span>(in DOMString name);
+ <span>HTMLAllCollection</span> <span title="dom-HTMLAllCollection-tags">tags</span>(in DOMString tagName);
+};</pre>
+
+ <dl class="domintro">
+
+ <dt><var title="">collection</var> . <code title="dom-HTMLAllCollection-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-HTMLAllCollection-item">item</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 <span>tree order</span>.</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">namedItem</code>(<var title="">name</var>)</dt>
+ <dt><var title="">collection</var> = <var title="">collection</var> . <code title="dom-HTMLAllCollection-item">namedItem</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>HTMLAllCollection</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</code>, <code>applet</code>, <code>area</code>,
+ <code>embed</code>, <code>form</code>, <code>frame</code>,
+ <code>frameset</code>, <code>iframe</code>, <code>img</code>, and
+ <code>object</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">tags</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 <span>represented by the collection</span>. If
+ there are no such elements, then there are no <span>supported
+ indexed properties</span>.</p>
+
+ <p>The <dfn
+ title="dom-HTMLAllCollection-length"><code>length</code></dfn>
+ attribute must return the number of nodes <span>represented by the
+ collection</span>.</p>
+
+ <p>The <dfn 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</code>, <code>applet</code>, <code>area</code>,
+ <code>embed</code>, <code>form</code>, <code>frame</code>,
+ <code>frameset</code>, <code>iframe</code>, <code>img</code>, and
+ <code>object</code> element <span>represented by the
+ collection</span> with a <code title="">name</code> attribute, plus
+ the list of IDs that the elements <span>represented by the
+ collection</span> have.</p>
+
+ <p>The <dfn
+ 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>HTMLAllCollection</code> object rooted at the same node as
+ the <code>HTMLAllCollection</code> object on which the method was
+ invoked, whose filter matches only only elements that already
+ match the filter of the <code>HTMLAllCollection</code> object on
+ which the method was invoked and that are either:</p>
+
+ <ul>
+
+ <li><code>a</code>, <code>applet</code>, <code>area</code>,
+ <code>embed</code>, <code>form</code>, <code>frame</code>,
+ <code>frameset</code>, <code>iframe</code>, <code>img</code>, or
+ <code>object</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 title="dom-HTMLAllCollection-tags"><code>tags(<var
+ title="">tagName</var>)</code></dfn> method must return an
+ <code>HTMLAllCollection</code> rooted at the same node as the
+ <code>HTMLAllCollection</code> object on which the method was
+ invoked, whose filter matches only <span>HTML elements</span> whose
+ local name is the <var title="">tagName</var> argument and that
+ already match the filter of the <code>HTMLAllCollection</code>
+ object on which the method was invoked. In <span>HTML
documents</span>, the argument must first be <span>converted to
ASCII lowercase</span>.</p>
More information about the Commit-Watchers
mailing list