Skip to content

Commit

Permalink
handle HTML elements with no 'name' attribute in HTMLCollection (for …
Browse files Browse the repository at this point in the history
…templateElements, tBodies, rows, etc)

git-svn-id: http://svn.whatwg.org/webapps@162 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 19, 2006
1 parent 3f7223d commit 4508cc4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 13 deletions.
27 changes: 20 additions & 7 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -1925,12 +1925,12 @@ and suggestions on this to the list, btw).
<h5 id=htmlcollection><span class=secno>2.3.1.1. </span>HTMLCollection</h5>

<p>The <code><a href="#htmlcollection0">HTMLCollection</a></code> interface
represents a generic <span>collection</span>.
represents a generic <span>collection</span> of elements.

<pre class=idl>interface <dfn id=htmlcollection0>HTMLCollection</dfn> {
readonly attribute unsigned long <a href="#length" title=dom-HTMLCollection-length>length</a>;
HTMLElement <a href="#itemindex" title=dom-HTMLCollection-item>item</a>(in unsigned long index);
HTMLElement <a href="#nameditem" title=dom-HTMLCollection-namedItem>namedItem</a>(in DOMString name);
Element <a href="#itemindex" title=dom-HTMLCollection-item>item</a>(in unsigned long index);
Element <a href="#nameditem" title=dom-HTMLCollection-namedItem>namedItem</a>(in DOMString name);
};</pre>

<p>The <dfn id=length
Expand All @@ -1946,10 +1946,23 @@ and suggestions on this to the list, btw).
<p>The <dfn id=nameditem
title=dom-HTMLCollection-namedItem><code>namedItem(<var
title="">key</var>)</code></dfn> method must return the first node in the
collection that has either an <code title=attr-id><a
href="#id">id</a></code> attribute or a <code title=attr-name>name</code>
attribute equal to the <var title="">key</var>, or null if no such node
exists.
collection that matches the following requirements:

<ul>
<li>It is an <code><a href="#a0">a</a></code>, <code>applet</code>,
<code>area</code>, <code>form</code>, <code><a
href="#img0">img</a></code>, or <code>object</code> element with a <code
title=attr-name>name</code> attribute equal to <var title="">key</var>,
or,

<li>It is an HTML element of any kind with an <code title=attr-id><a
href="#id">id</a></code> attribute equal to <var title="">key</var>.
(Non-HTML elements, even if they have IDs, are not searched for the
purposes of <code title=dom-HTMLCollection-namedItem><a
href="#nameditem">namedItem()</a></code>.)
</ul>

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

<p>In the ECMAScript DOM binding, objects implementing the <code><a
href="#htmlcollection0">HTMLCollection</a></code> interface must support
Expand Down
29 changes: 23 additions & 6 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -974,12 +974,12 @@ and suggestions on this to the list, btw).
<h5>HTMLCollection</h5>

<p>The <code>HTMLCollection</code> interface represents a generic
<span>collection</span>.</p>
<span>collection</span> of elements.</p>

<pre class="idl">interface <dfn>HTMLCollection</dfn> {
readonly attribute unsigned long <span title="dom-HTMLCollection-length">length</span>;
HTMLElement <span title="dom-HTMLCollection-item">item</span>(in unsigned long index);
HTMLElement <span title="dom-HTMLCollection-namedItem">namedItem</span>(in DOMString name);
Element <span title="dom-HTMLCollection-item">item</span>(in unsigned long index);
Element <span title="dom-HTMLCollection-namedItem">namedItem</span>(in DOMString name);
};</pre>

<p>The <dfn
Expand All @@ -996,9 +996,26 @@ and suggestions on this to the list, btw).
<p>The <dfn
title="dom-HTMLCollection-namedItem"><code>namedItem(<var
title="">key</var>)</code></dfn> method must return the first node
in the collection that has either an <code title="attr-id">id</code>
attribute or a <code title="attr-name">name</code> attribute equal
to the <var title="">key</var>, or null if no such node exists.</p>
in the collection that matches the following requirements:</p>

<ul>

<li>It is an <code>a</code>, <code>applet</code>,
<code>area</code>, <code>form</code>, <code>img</code>, or
<code>object</code> element with a <code
title="attr-name">name</code> attribute equal to <var
title="">key</var>, or,</li>

<li>It is an HTML element of any kind with an <code
title="attr-id">id</code> attribute equal to <var
title="">key</var>. (Non-HTML elements, even if they have IDs, are
not searched for the purposes of <code
title="dom-HTMLCollection-namedItem">namedItem()</code>.)</li>

</ul>

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

<p>In the ECMAScript DOM binding, objects implementing the
<code>HTMLCollection</code> interface must support being
Expand Down

0 comments on commit 4508cc4

Please sign in to comment.