Skip to content

Commit

Permalink
[e] (0) Various HTMLAllCollection fixes
Browse files Browse the repository at this point in the history
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=25817
Affected topics: DOM APIs

git-svn-id: http://svn.whatwg.org/webapps@8645 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed May 20, 2014
1 parent df50d51 commit 55a3f23
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 31 deletions.
30 changes: 19 additions & 11 deletions complete.html
Expand Up @@ -290,7 +290,7 @@
</script><body onload=init()>
<header class="head with-buttons" id=head><p><a href=//www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 19 May 2014</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 20 May 2014</h2>
</hgroup><div>
<div>
<a href=//whatwg.org/html><span><strong>Multipage Version</strong> <code>whatwg.org/html</code></span></a>
Expand Down Expand Up @@ -7569,13 +7569,18 @@ <h4 id=collections-0><span class=secno>2.7.2 </span>Collections</h4>

<h5 id=htmlallcollection-0><span class=secno>2.7.2.1 </span>HTMLAllCollection</h5>

<p>The <code><a href=#htmlallcollection>HTMLAllCollection</a></code> interface is used for generic <a href=#collections>collections</a> of
elements just like <code><a href=#htmlcollection>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>HTMLCollection</a></code> object when there are multiple matching elements, and that its <code title=dom-HTMLAllCollection-item>item()</code> method can be used as a synonym for its <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method. It is intended only for the
legacy <code title=dom-document-all><a href=#dom-document-all>document.all</a></code> attribute.</p>
<p>The <code><a href=#htmlallcollection>HTMLAllCollection</a></code> interface is used for the legacy <code title=dom-document-all><a href=#dom-document-all>document.all</a></code> attribute. It operates similarly to
<code><a href=#htmlcollection>HTMLCollection</a></code>; the main differences are that its <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method returns an
<code><a href=#htmlcollection>HTMLCollection</a></code> object when there are multiple matching elements, and that its <code title=dom-HTMLAllCollection-item><a href=#dom-htmlallcollection-item>item()</a></code> method can be used as a synonym for its <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method.</p>

<p class=note>All <code><a href=#htmlallcollection>HTMLAllCollection</a></code> objects are rooted at a <code><a href=#document>Document</a></code>
and have a filter that matches all elements, so the elements <a href=#represented-by-the-collection>represented by the
collection</a> of an <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object consist of all the descendant
elements of the root <code><a href=#document>Document</a></code>.</p>

<pre class=idl>interface <dfn id=htmlallcollection>HTMLAllCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
// inherits <span title=dom-HTMLCollection-length>length</span> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>(unsigned long index)
// inherits <span title=dom-HTMLCollection-length>length</span> and 'getter'
<a href=#element>Element</a>? <a href=#dom-htmlallcollection-item title=dom-HTMLAllCollection-item>item</a>(unsigned long index);
(<a href=#htmlcollection>HTMLCollection</a> or <a href=#element>Element</a>)? <a href=#dom-htmlallcollection-item-string title=dom-HTMLAllCollection-item-string>item</a>(DOMString name);
legacycaller getter (<a href=#htmlcollection>HTMLCollection</a> or <a href=#element>Element</a>)? <a href=#dom-htmlallcollection-nameditem title=dom-HTMLAllCollection-namedItem>namedItem</a>(DOMString name); // shadows inherited namedItem()
};</pre>
Expand All @@ -7585,7 +7590,7 @@ <h5 id=htmlallcollection-0><span class=secno>2.7.2.1 </span>HTMLAllCollection</h
<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><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
<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>
Expand Down Expand Up @@ -7613,6 +7618,10 @@ <h5 id=htmlallcollection-0><span class=secno>2.7.2.1 </span>HTMLAllCollection</h
<p>The object's <a href=#supported-property-indices>supported property indices</a> are as defined for
<code><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>

<p>The <dfn id=dom-htmlallcollection-item title=dom-HTMLAllCollection-item><code>item()</code></dfn> method, when invoked
with a numeric argument, must act like the <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item()</a>
method inherited from <code><a href=#htmlcollection>HTMLCollection</a></code>.</p>

<!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2837 -->
<p>The following elements are <dfn id=all-named-elements>"all"-named elements</dfn>:
<code><a href=#the-a-element>a</a></code>, <!-- in some browsers -->
Expand Down Expand Up @@ -7650,11 +7659,10 @@ <h5 id=htmlallcollection-0><span class=secno>2.7.2.1 </span>HTMLAllCollection</h
<li>

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

<ul><li><a href=#all-named-elements>"all"-named elements</a> with a <code title="">name</code> attribute
<ul><!--CLEANUP--><!--2x--><li><a href=#all-named-elements>"all"-named elements</a> with a <code title="">name</code> attribute
equal to <var title="">name</var>, or,</li>

<li>elements with an <a href=#concept-id title=concept-id>ID</a> equal to <var title="">name</var>.</li>
Expand Down
30 changes: 19 additions & 11 deletions index
Expand Up @@ -290,7 +290,7 @@
</script><body onload=init()>
<header class="head with-buttons" id=head><p><a href=//www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 19 May 2014</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 20 May 2014</h2>
</hgroup><div>
<div>
<a href=//whatwg.org/html><span><strong>Multipage Version</strong> <code>whatwg.org/html</code></span></a>
Expand Down Expand Up @@ -7569,13 +7569,18 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

<h5 id=htmlallcollection-0><span class=secno>2.7.2.1 </span>HTMLAllCollection</h5>

<p>The <code><a href=#htmlallcollection>HTMLAllCollection</a></code> interface is used for generic <a href=#collections>collections</a> of
elements just like <code><a href=#htmlcollection>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>HTMLCollection</a></code> object when there are multiple matching elements, and that its <code title=dom-HTMLAllCollection-item>item()</code> method can be used as a synonym for its <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method. It is intended only for the
legacy <code title=dom-document-all><a href=#dom-document-all>document.all</a></code> attribute.</p>
<p>The <code><a href=#htmlallcollection>HTMLAllCollection</a></code> interface is used for the legacy <code title=dom-document-all><a href=#dom-document-all>document.all</a></code> attribute. It operates similarly to
<code><a href=#htmlcollection>HTMLCollection</a></code>; the main differences are that its <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method returns an
<code><a href=#htmlcollection>HTMLCollection</a></code> object when there are multiple matching elements, and that its <code title=dom-HTMLAllCollection-item><a href=#dom-htmlallcollection-item>item()</a></code> method can be used as a synonym for its <code title=dom-HTMLAllCollection-namedItem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method.</p>

<p class=note>All <code><a href=#htmlallcollection>HTMLAllCollection</a></code> objects are rooted at a <code><a href=#document>Document</a></code>
and have a filter that matches all elements, so the elements <a href=#represented-by-the-collection>represented by the
collection</a> of an <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object consist of all the descendant
elements of the root <code><a href=#document>Document</a></code>.</p>

<pre class=idl>interface <dfn id=htmlallcollection>HTMLAllCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
// inherits <span title=dom-HTMLCollection-length>length</span> and <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item</a>(unsigned long index)
// inherits <span title=dom-HTMLCollection-length>length</span> and 'getter'
<a href=#element>Element</a>? <a href=#dom-htmlallcollection-item title=dom-HTMLAllCollection-item>item</a>(unsigned long index);
(<a href=#htmlcollection>HTMLCollection</a> or <a href=#element>Element</a>)? <a href=#dom-htmlallcollection-item-string title=dom-HTMLAllCollection-item-string>item</a>(DOMString name);
legacycaller getter (<a href=#htmlcollection>HTMLCollection</a> or <a href=#element>Element</a>)? <a href=#dom-htmlallcollection-nameditem title=dom-HTMLAllCollection-namedItem>namedItem</a>(DOMString name); // shadows inherited namedItem()
};</pre>
Expand All @@ -7585,7 +7590,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<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><a href=#dom-htmlcollection-item>item</a></code>(<var title="">index</var>)</dt>
<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>
Expand Down Expand Up @@ -7613,6 +7618,10 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<p>The object's <a href=#supported-property-indices>supported property indices</a> are as defined for
<code><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>

<p>The <dfn id=dom-htmlallcollection-item title=dom-HTMLAllCollection-item><code>item()</code></dfn> method, when invoked
with a numeric argument, must act like the <a href=#dom-htmlcollection-item title=dom-HTMLCollection-item>item()</a>
method inherited from <code><a href=#htmlcollection>HTMLCollection</a></code>.</p>

<!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2837 -->
<p>The following elements are <dfn id=all-named-elements>"all"-named elements</dfn>:
<code><a href=#the-a-element>a</a></code>, <!-- in some browsers -->
Expand Down Expand Up @@ -7650,11 +7659,10 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<li>

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

<ul><li><a href=#all-named-elements>"all"-named elements</a> with a <code title="">name</code> attribute
<ul><!--CLEANUP--><!--2x--><li><a href=#all-named-elements>"all"-named elements</a> with a <code title="">name</code> attribute
equal to <var title="">name</var>, or,</li>

<li>elements with an <a href=#concept-id title=concept-id>ID</a> equal to <var title="">name</var>.</li>
Expand Down
28 changes: 19 additions & 9 deletions source
Expand Up @@ -7039,16 +7039,22 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

<h5>HTMLAllCollection</h5>

<p>The <code>HTMLAllCollection</code> interface is used for generic <span>collections</span> of
elements just like <code>HTMLCollection</code>, with the exception that its <code
<p>The <code>HTMLAllCollection</code> interface is used for the legacy <code
data-x="dom-document-all">document.all</code> attribute. It operates similarly to
<code>HTMLCollection</code>; the main differences are that its <code
data-x="dom-HTMLAllCollection-namedItem">namedItem()</code> method returns an
<code>HTMLCollection</code> object when there are multiple matching elements, and that its <code
data-x="dom-HTMLAllCollection-item">item()</code> method can be used as a synonym for its <code
data-x="dom-HTMLAllCollection-namedItem">namedItem()</code> method. It is intended only for the
legacy <code data-x="dom-document-all">document.all</code> attribute.</p>
data-x="dom-HTMLAllCollection-namedItem">namedItem()</code> method.</p>

<p class="note">All <code>HTMLAllCollection</code> objects are rooted at a <code>Document</code>
and have a filter that matches all elements, so the elements <span>represented by the
collection</span> of an <code>HTMLAllCollection</code> object consist of all the descendant
elements of the root <code>Document</code>.</p>

<pre class="idl">interface <dfn>HTMLAllCollection</dfn> : <span>HTMLCollection</span> {
// inherits <span data-x="dom-HTMLCollection-length">length</span> and <span data-x="dom-HTMLCollection-item">item</span>(unsigned long index)
// inherits <span data-x="dom-HTMLCollection-length">length</span> and 'getter'
<span>Element</span>? <span data-x="dom-HTMLAllCollection-item">item</span>(unsigned long index);
(<span>HTMLCollection</span> or <span>Element</span>)? <span data-x="dom-HTMLAllCollection-item-string">item</span>(DOMString name);
legacycaller getter (<span>HTMLCollection</span> or <span>Element</span>)? <span data-x="dom-HTMLAllCollection-namedItem">namedItem</span>(DOMString name); // shadows inherited namedItem()
};</pre>
Expand All @@ -7060,7 +7066,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<p>Returns the number of elements in the collection.</p>
</dd>

<dt><var data-x="">element</var> = <var data-x="">collection</var> . <code data-x="dom-HTMLCollection-item">item</code>(<var data-x="">index</var>)</dt>
<dt><var data-x="">element</var> = <var data-x="">collection</var> . <code data-x="dom-HTMLAllCollection-item">item</code>(<var data-x="">index</var>)</dt>
<dt><var data-x="">collection</var>[<var data-x="">index</var>]</dt>
<dd>
<p>Returns the item with index <var data-x="">index</var> from the collection. The items are sorted in <span>tree order</span>.</p>
Expand Down Expand Up @@ -7090,6 +7096,10 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<p>The object's <span>supported property indices</span> are as defined for
<code>HTMLCollection</code> objects.</p>

<p>The <dfn data-x="dom-HTMLAllCollection-item"><code>item()</code></dfn> method, when invoked
with a numeric argument, must act like the <span data-x="dom-HTMLCollection-item">item()</span>
method inherited from <code>HTMLCollection</code>.</p>

<!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2837 -->
<p>The following elements are <dfn>"all"-named elements</dfn>:
<code>a</code>, <!-- in some browsers -->
Expand Down Expand Up @@ -7132,11 +7142,11 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<li>

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

<ul>
<!--CLEANUP--><!--2x-->

<li><span>"all"-named elements</span> with a <code data-x="">name</code> attribute
equal to <var data-x="">name</var>, or,</li>
Expand Down

0 comments on commit 55a3f23

Please sign in to comment.