[html5] r7586 - [giow] (3) Try to simplify the spec by matching the simpler implementations wher [...]

whatwg at whatwg.org whatwg at whatwg.org
Fri Dec 14 15:52:30 PST 2012


Author: ianh
Date: 2012-12-14 15:52:29 -0800 (Fri, 14 Dec 2012)
New Revision: 7586

Modified:
   complete.html
   index
   source
Log:
[giow] (3) Try to simplify the spec by matching the simpler implementations where there is poor interop.
Affected topics: DOM APIs

Modified: complete.html
===================================================================
--- complete.html	2012-12-13 21:02:12 UTC (rev 7585)
+++ complete.html	2012-12-14 23:52:29 UTC (rev 7586)
@@ -248,7 +248,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 13 December 2012</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 14 December 2012</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -8711,10 +8711,8 @@
 
   <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=#htmlallcollection>HTMLAllCollection</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>
+  <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>
 
   <pre class=idl>interface <dfn id=htmlallcollection>HTMLAllCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
   // inherits <span title=dom-HTMLCollection-length>length</span> and <span title=dom-HTMLCollection-item>item</span>(unsigned long index)
@@ -8743,7 +8741,7 @@
    <dt><var title="">collection</var>(<var title="">name</var>)</dt>
    <dd>
     <p>Returns the item with <a href=#concept-id title=concept-id>ID</a> or name <var title="">name</var> from the collection.</p>
-    <p>If there are multiple matching items, then an <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object containing all those elements is returned.</p>
+    <p>If there are multiple matching items, then an <code><a href=#htmlcollection>HTMLCollection</a></code> object containing all those elements is returned.</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
@@ -8765,7 +8763,7 @@
 
   <ol><li>
 
-    <p>Let <var title="">collection</var> be an <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object rooted at the
+    <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>
@@ -8933,7 +8931,7 @@
    <dt><var title="">collection</var>(<var title="">name</var>)</dt>
    <dd>
     <p>Returns the item with <a href=#concept-id title=concept-id>ID</a> or <code title=attr-option-name><a href=#attr-option-name>name</a></code> <var title="">name</var> from the collection.</p>
-    <p>If there are multiple matching items, then a <code><a href=#nodelist>NodeList</a></code> object containing all those elements is returned.</p>
+    <p>If there are multiple matching items, then the first is returned.</p>
    </dd>
 
    <dt><var title="">collection</var> . <code title=dom-HTMLOptionsCollection-add><a href=#dom-htmloptionscollection-add>add</a></code>(<var title="">element</var> [, <var title="">before</var> ] )</dt>
@@ -8979,25 +8977,11 @@
   <p>The <a href=#supported-property-names>supported property names</a> consist of the values of all the <code title=attr-id><a href=#the-id-attribute>id</a></code> and <code title=attr-option-name><a href=#attr-option-name>name</a></code> attributes of all the
   elements <a href=#represented-by-the-collection>represented by the collection</a>.</p>
 
-  <p>The <dfn id=dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must act according to the following algorithm:</p>
+  <p>The <dfn id=dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must return the first node in the collection that has
+  either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute equal to <var title="">name</var>, if there is one;
+  otherwise, it must return null.</p>
 
-  <ol><li>If, at the time the method is called, there is exactly one node in the collection that has
-   either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute equal to <var title="">name</var>, then return
-   that node and stop the algorithm.</li>
-
-   <li>Otherwise, if there are no nodes in the collection that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute
-   equal to <var title="">name</var>, then return null and stop the algorithm.</li>
-
-   <!-- IE returns an HTMLCollection instead; we may need to change to that for compat -->
-   <li>Otherwise, create a new <code><a href=#nodelist>NodeList</a></code> object representing a <a href=#live>live</a> view of
-   the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> object, further filtered so that the only nodes in the
-   <code><a href=#nodelist>NodeList</a></code> object are those that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code>
-   attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute equal to <var title="">name</var>. The nodes in the <code><a href=#nodelist>NodeList</a></code> object must be sorted in <a href=#tree-order>tree
-   order</a>.</li>
-
-   <li>Return that <code><a href=#nodelist>NodeList</a></code> object.</li>
-
-  </ol><p>When the user agent is to <dfn id=dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
+  <p>When the user agent is to <dfn id=dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
   indexed property</dfn> for a given property index <var title="">index</var> to a new value <var title="">value</var>, it must run the following algorithm:</p>
 
   <ol><li><p>If <var title="">value</var> is null, invoke the steps for the <code title=dom-HTMLOptionsCollection-remove><a href=#dom-htmloptionscollection-remove>remove</a></code> method with <var title="">index</var> as

Modified: index
===================================================================
--- index	2012-12-13 21:02:12 UTC (rev 7585)
+++ index	2012-12-14 23:52:29 UTC (rev 7586)
@@ -248,7 +248,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 13 December 2012</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 14 December 2012</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -8711,10 +8711,8 @@
 
   <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=#htmlallcollection>HTMLAllCollection</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>
+  <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>
 
   <pre class=idl>interface <dfn id=htmlallcollection>HTMLAllCollection</dfn> : <a href=#htmlcollection>HTMLCollection</a> {
   // inherits <span title=dom-HTMLCollection-length>length</span> and <span title=dom-HTMLCollection-item>item</span>(unsigned long index)
@@ -8743,7 +8741,7 @@
    <dt><var title="">collection</var>(<var title="">name</var>)</dt>
    <dd>
     <p>Returns the item with <a href=#concept-id title=concept-id>ID</a> or name <var title="">name</var> from the collection.</p>
-    <p>If there are multiple matching items, then an <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object containing all those elements is returned.</p>
+    <p>If there are multiple matching items, then an <code><a href=#htmlcollection>HTMLCollection</a></code> object containing all those elements is returned.</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
@@ -8765,7 +8763,7 @@
 
   <ol><li>
 
-    <p>Let <var title="">collection</var> be an <code><a href=#htmlallcollection>HTMLAllCollection</a></code> object rooted at the
+    <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>
@@ -8933,7 +8931,7 @@
    <dt><var title="">collection</var>(<var title="">name</var>)</dt>
    <dd>
     <p>Returns the item with <a href=#concept-id title=concept-id>ID</a> or <code title=attr-option-name><a href=#attr-option-name>name</a></code> <var title="">name</var> from the collection.</p>
-    <p>If there are multiple matching items, then a <code><a href=#nodelist>NodeList</a></code> object containing all those elements is returned.</p>
+    <p>If there are multiple matching items, then the first is returned.</p>
    </dd>
 
    <dt><var title="">collection</var> . <code title=dom-HTMLOptionsCollection-add><a href=#dom-htmloptionscollection-add>add</a></code>(<var title="">element</var> [, <var title="">before</var> ] )</dt>
@@ -8979,25 +8977,11 @@
   <p>The <a href=#supported-property-names>supported property names</a> consist of the values of all the <code title=attr-id><a href=#the-id-attribute>id</a></code> and <code title=attr-option-name><a href=#attr-option-name>name</a></code> attributes of all the
   elements <a href=#represented-by-the-collection>represented by the collection</a>.</p>
 
-  <p>The <dfn id=dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must act according to the following algorithm:</p>
+  <p>The <dfn id=dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must return the first node in the collection that has
+  either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute equal to <var title="">name</var>, if there is one;
+  otherwise, it must return null.</p>
 
-  <ol><li>If, at the time the method is called, there is exactly one node in the collection that has
-   either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute equal to <var title="">name</var>, then return
-   that node and stop the algorithm.</li>
-
-   <li>Otherwise, if there are no nodes in the collection that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute
-   equal to <var title="">name</var>, then return null and stop the algorithm.</li>
-
-   <!-- IE returns an HTMLCollection instead; we may need to change to that for compat -->
-   <li>Otherwise, create a new <code><a href=#nodelist>NodeList</a></code> object representing a <a href=#live>live</a> view of
-   the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> object, further filtered so that the only nodes in the
-   <code><a href=#nodelist>NodeList</a></code> object are those that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code>
-   attribute or a <code title=attr-option-name><a href=#attr-option-name>name</a></code> attribute equal to <var title="">name</var>. The nodes in the <code><a href=#nodelist>NodeList</a></code> object must be sorted in <a href=#tree-order>tree
-   order</a>.</li>
-
-   <li>Return that <code><a href=#nodelist>NodeList</a></code> object.</li>
-
-  </ol><p>When the user agent is to <dfn id=dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
+  <p>When the user agent is to <dfn id=dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
   indexed property</dfn> for a given property index <var title="">index</var> to a new value <var title="">value</var>, it must run the following algorithm:</p>
 
   <ol><li><p>If <var title="">value</var> is null, invoke the steps for the <code title=dom-HTMLOptionsCollection-remove><a href=#dom-htmloptionscollection-remove>remove</a></code> method with <var title="">index</var> as

Modified: source
===================================================================
--- source	2012-12-13 21:02:12 UTC (rev 7585)
+++ source	2012-12-14 23:52:29 UTC (rev 7586)
@@ -8494,10 +8494,10 @@
   <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
   title="dom-HTMLAllCollection-namedItem">namedItem()</code> method returns an
-  <code>HTMLAllCollection</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">namedItem()</code> method. It is intended only for
-  the legacy <code title="dom-document-all">document.all</code> attribute.</p>
+  <code>HTMLCollection</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">namedItem()</code> method. It is intended only for the
+  legacy <code title="dom-document-all">document.all</code> attribute.</p>
 
   <pre class="idl">interface <dfn>HTMLAllCollection</dfn> : <span>HTMLCollection</span> {
   // inherits <span title="dom-HTMLCollection-length">length</span> and <span title="dom-HTMLCollection-item">item</span>(unsigned long index)
@@ -8528,7 +8528,7 @@
    <dt><var title="">collection</var>(<var title="">name</var>)</dt>
    <dd>
     <p>Returns the item with <span title="concept-id">ID</span> 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>If there are multiple matching items, then an <code>HTMLCollection</code> object containing all those elements is returned.</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
@@ -8556,7 +8556,7 @@
 
    <li>
 
-    <p>Let <var title="">collection</var> be an <code>HTMLAllCollection</code> object rooted at the
+    <p>Let <var title="">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>
@@ -8766,7 +8766,7 @@
    <dt><var title="">collection</var>(<var title="">name</var>)</dt>
    <dd>
     <p>Returns the item with <span title="concept-id">ID</span> or <code title="attr-option-name">name</code> <var title="">name</var> from the collection.</p>
-    <p>If there are multiple matching items, then a <code>NodeList</code> object containing all those elements is returned.</p>
+    <p>If there are multiple matching items, then the first is returned.</p>
    </dd>
 
    <dt><var title="">collection</var> . <code title="dom-HTMLOptionsCollection-add">add</code>(<var title="">element</var> [, <var title="">before</var> ] )</dt>
@@ -8822,31 +8822,11 @@
   elements <span>represented by the collection</span>.</p>
 
   <p>The <dfn title="dom-HTMLOptionsCollection-namedItem"><code>namedItem(<var
-  title="">name</var>)</code></dfn> method must act according to the following algorithm:</p>
+  title="">name</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-option-name">name</code> attribute equal to <var title="">name</var>, if there is one;
+  otherwise, it must return null.</p>
 
-  <ol>
-
-   <li>If, at the time the method is called, there is exactly one node in the collection that has
-   either an <code title="attr-id">id</code> attribute or a <code
-   title="attr-option-name">name</code> attribute equal to <var title="">name</var>, then return
-   that node and stop the algorithm.</li>
-
-   <li>Otherwise, if there are no nodes in the collection that have either an <code
-   title="attr-id">id</code> attribute or a <code title="attr-option-name">name</code> attribute
-   equal to <var title="">name</var>, then return null and stop the algorithm.</li>
-
-   <!-- IE returns an HTMLCollection instead; we may need to change to that for compat -->
-   <li>Otherwise, create a new <code>NodeList</code> object representing a <span>live</span> view of
-   the <code>HTMLOptionsCollection</code> object, further filtered so that the only nodes in the
-   <code>NodeList</code> object are those that have either an <code title="attr-id">id</code>
-   attribute or a <code title="attr-option-name">name</code> attribute equal to <var
-   title="">name</var>. The nodes in the <code>NodeList</code> object must be sorted in <span>tree
-   order</span>.</li>
-
-   <li>Return that <code>NodeList</code> object.</li>
-
-  </ol>
-
   <p>When the user agent is to <dfn title="dom-HTMLOptionsCollection-setter">set the value of a new
   indexed property</dfn> for a given property index <var title="">index</var> to a new value <var
   title="">value</var>, it must run the following algorithm:</p>




More information about the Commit-Watchers mailing list