hixie: Define HTMLAllCollection for document.all. (Should we give it the [[Class]] HTMLCollection?) (whatwg r3409)

hixie: Define HTMLAllCollection for document.all. (Should we give it the
[[Class]] HTMLCollection?) (whatwg r3409)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2538&r2=1.2539&f=h
http://html5.org/tools/web-apps-tracker?from=3408&to=3409

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.2538
retrieving revision 1.2539
diff -u -d -r1.2538 -r1.2539
--- Overview.html 14 Jul 2009 06:33:45 -0000 1.2538
+++ Overview.html 14 Jul 2009 07:21:42 -0000 1.2539
@@ -364,9 +364,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>
@@ -4745,7 +4746,7 @@
   attribute. Otherwise, the DOM attribute must be set to the empty
   string.</p>
 
-  </div><h4 id="collections"><span class="secno">2.8.2 </span>Collections</h4><p>The <code><a href="#htmlcollection-0">HTMLCollection</a></code>,
+  </div><h4 id="collections"><span class="secno">2.8.2 </span>Collections</h4><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
@@ -4778,7 +4779,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>
    <dd>
     <p>Returns the number of elements in the collection.</p>
@@ -4792,7 +4793,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>
@@ -4851,14 +4851,123 @@
   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><p>The <code><a href="#htmlformcontrolscollection-0">HTMLFormControlsCollection</a></code> interface represents
+  </div><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>
   and <code><a href="#the-fieldset-element">fieldset</a></code> elements.<pre class="idl">[Callable=<a href="#dom-htmlformcontrolscollection-nameditem" title="dom-HTMLFormControlsCollection-namedItem">namedItem</a>]
 interface <dfn id="htmlformcontrolscollection-0">HTMLFormControlsCollection</dfn> {
@@ -4982,7 +5091,7 @@
 
   </ol><!--
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E...%0A%3Cform%20name%3D%22a%22%3E%3Cinput%20id%3D%22x%22%20name%3D%22y%22%3E%3Cinput%20name%3D%22x%22%20id%3D%22y%22%3E%3C/form%3E%0A%3Cscript%3E%0A%20%20var%20x%3B%0A%20%20w%28x%20%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20x%5B0%5D.parentNode.removeChild%28x%5B0%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20w%28x%20%3D%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%3C/script%3E%0A
---></div><h5 id="htmloptionscollection"><span class="secno">2.8.2.3 </span>HTMLOptionsCollection</h5><p>The <code><a href="#htmloptionscollection-0">HTMLOptionsCollection</a></code> interface represents a
+--></div><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
   <code><a href="#the-select-element">select</a></code> element and has attributes and methods that
   manipulate that element's descendants.<pre class="idl">[Callable=<a href="#dom-htmloptionscollection-nameditem" title="dom-HTMLOptionsCollection-namedItem">namedItem</a>]
@@ -5136,7 +5245,7 @@
    <li><p>Remove <var title="">element</var> from its parent
    node.</li>
 
-  </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><p>The <code><a href="#htmlpropertycollection-0">HTMLPropertyCollection</a></code> interface represents a
+  </ol><!-- see also http://ln.hixie.ch/?start=1161042744&count=1 --></div><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
   name-value pairs to a particular <a href="#concept-item" title="concept-item">item</a> in the <a href="#microdata">microdata</a>
   model.<pre class="idl">[Callable=<a href="#dom-htmlpropertycollection-nameditem" title="dom-HTMLPropertyCollection-namedItem">namedItem</a>]

Received on Tuesday, 14 July 2009 07:23:45 UTC