HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
3409Define HTMLAllCollection for document.all. (Should we give it the [[Class]] HTMLCollection?)2009-07-14 07:21
@@ -4943,21 +4943,21 @@ a.<span title="dom-uda-protocol">protocol</span> = 'https'; // change just the s
   title="attr-id">id</code> attribute, then the content attribute must
   be set to the value of that <code title="attr-id">id</code>
   attribute. Otherwise, the DOM attribute must be set to the empty
   string.</p>
 
   </div>
 
 
   <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
   lists of DOM nodes. Collectively, objects implementing these
   interfaces are called <dfn>collections</dfn>.</p>
 
   <p>When a <span title="collections">collection</span> is created, a
   filter and a root are associated with the collection.</p>
 
   <p class="example">For example, when the <code>HTMLCollection</code>
@@ -4995,39 +4995,38 @@ a.<span title="dom-uda-protocol">protocol</span> = 'https'; // change just the s
        so we might need to change this for compat. However, Web IDL doesn't support that for now. -->
   <!-- heycam says we could just say something like "In the ECMAScript binding, host objects that implement interface
        <code>HTMLCollection</code> have a [[Call]] method that that behaves as follows: 1. If called with 0 or more than 1
        argument, throw a TypeError. 2. Let arg be the single argument passed. 3. Invoke [[Get]] on the object with ToString(argument)
        as the property name. 4. Return Result(3)." (but we'd have to verify that that's right for 0 and >1 args) -->
   <pre class="idl">[Callable=<span title="dom-HTMLCollection-namedItem">namedItem</span>]
 interface <dfn>HTMLCollection</dfn> {
   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">
 
    <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">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-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>
     <p>Returns the first item with ID or name <var title="">name</var>
     from the collection.</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
@@ -5089,24 +5088,167 @@ interface <dfn>HTMLCollection</dfn> {
 
    <li>It is an element with an ID <var title="">key</var>.</li>
 
   </ul>
 
   <p>If no such elements are found, then the method must return
   null.</p>
 
   <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>
 
   </div>
 
 
   <h5>HTMLFormControlsCollection</h5>
 
   <p>The <code>HTMLFormControlsCollection</code> interface represents
   a <span title="collections">collection</span> of <span

|