[html5] r8481 - [giow] (3) Turns out select.remove() and select.options.remove() convert object [...]

whatwg at whatwg.org whatwg at whatwg.org
Thu Feb 20 14:10:31 PST 2014


Author: ianh
Date: 2014-02-20 14:10:30 -0800 (Thu, 20 Feb 2014)
New Revision: 8481

Modified:
   complete.html
   index
   source
Log:
[giow] (3) Turns out select.remove() and select.options.remove() convert object arguments to zero.
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=24746
Affected topics: DOM APIs

Modified: complete.html
===================================================================
--- complete.html	2014-02-20 20:32:00 UTC (rev 8480)
+++ complete.html	2014-02-20 22:10:30 UTC (rev 8481)
@@ -7751,7 +7751,7 @@
   <a href=#dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem>legacycaller</a> <a href=#htmloptionelement>HTMLOptionElement</a>? (DOMString name);
   <a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>setter creator</a> void (unsigned long index, <a href=#htmloptionelement>HTMLOptionElement</a>? option);
   void <a href=#dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add>add</a>((<a href=#htmloptionelement>HTMLOptionElement</a> or <a href=#htmloptgroupelement>HTMLOptGroupElement</a>) element, optional (<a href=#htmlelement>HTMLElement</a> or long)? before = null);
-  void <a href=#dom-htmloptionscollection-remove title=dom-HTMLOptionsCollection-remove>remove</a>(long index);
+  void <a href=#dom-htmloptionscollection-remove title=dom-HTMLOptionsCollection-remove>remove</a>((long or object?) index);
            attribute long <a href=#dom-htmloptionscollection-selectedindex title=dom-HTMLOptionsCollection-selectedIndex>selectedIndex</a>;
 };</pre>
 
@@ -7826,6 +7826,7 @@
   <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> interface must act like the <code title=dom-HTMLCollection-namedItem>namedItem()</code> method on the ancestor
   <code><a href=#htmlcollection>HTMLCollection</a></code> interface.</p>
 
+<!--CLEANUP-->
   <p>When the user agent is to <dfn id=dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
   indexed property or set the value of an existing 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>
 
@@ -7874,9 +7875,16 @@
   <ol><li><p>If the number of nodes <a href=#represented-by-the-collection>represented by the collection</a> is zero, abort these
    steps.</li>
 
+   <li><p>If the argument <var title="">index</var> is not a number, set it to zero.</li>
+   <!-- objects get converted to zero: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2828 -->
+   <!-- same for select.remove(), which calls this algorithm also:
+         http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2826
+         http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2825
+         http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2827
+     -->
+
    <li><p>If <var title="">index</var> is not a number greater than or equal to 0 and less than the
    number of nodes <a href=#represented-by-the-collection>represented by the collection</a>, abort these steps.</li>
-
    <!-- note that Web IDL converts 'a', NaN, -0.5, 0.5, and null to 0, and numbers in general
    truncate. so what we're checking against here in a way has very little to do with what's going on
    in the JS -->
@@ -44645,7 +44653,7 @@
   <a href=#htmloptionelement>HTMLOptionElement</a>? <a href=#dom-select-nameditem title=dom-select-namedItem>namedItem</a>(DOMString name);
   void <a href=#dom-select-add title=dom-select-add>add</a>((<a href=#htmloptionelement>HTMLOptionElement</a> or <a href=#htmloptgroupelement>HTMLOptGroupElement</a>) element, optional (<a href=#htmlelement>HTMLElement</a> or long)? before = null);
   void <a href=#dom-select-remove title=dom-select-remove>remove</a>(); // ChildNode overload
-  void <a href=#dom-select-remove title=dom-select-remove>remove</a>(long index);
+  void <a href=#dom-select-remove title=dom-select-remove>remove</a>((long or object?) index);
   <a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>setter creator</a> void (unsigned long index, <a href=#htmloptionelement>HTMLOptionElement</a>? option);
 
   readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-select-selectedoptions title=dom-select-selectedOptions>selectedOptions</a>;

Modified: index
===================================================================
--- index	2014-02-20 20:32:00 UTC (rev 8480)
+++ index	2014-02-20 22:10:30 UTC (rev 8481)
@@ -7751,7 +7751,7 @@
   <a href=#dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem>legacycaller</a> <a href=#htmloptionelement>HTMLOptionElement</a>? (DOMString name);
   <a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>setter creator</a> void (unsigned long index, <a href=#htmloptionelement>HTMLOptionElement</a>? option);
   void <a href=#dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add>add</a>((<a href=#htmloptionelement>HTMLOptionElement</a> or <a href=#htmloptgroupelement>HTMLOptGroupElement</a>) element, optional (<a href=#htmlelement>HTMLElement</a> or long)? before = null);
-  void <a href=#dom-htmloptionscollection-remove title=dom-HTMLOptionsCollection-remove>remove</a>(long index);
+  void <a href=#dom-htmloptionscollection-remove title=dom-HTMLOptionsCollection-remove>remove</a>((long or object?) index);
            attribute long <a href=#dom-htmloptionscollection-selectedindex title=dom-HTMLOptionsCollection-selectedIndex>selectedIndex</a>;
 };</pre>
 
@@ -7826,6 +7826,7 @@
   <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> interface must act like the <code title=dom-HTMLCollection-namedItem>namedItem()</code> method on the ancestor
   <code><a href=#htmlcollection>HTMLCollection</a></code> interface.</p>
 
+<!--CLEANUP-->
   <p>When the user agent is to <dfn id=dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
   indexed property or set the value of an existing 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>
 
@@ -7874,9 +7875,16 @@
   <ol><li><p>If the number of nodes <a href=#represented-by-the-collection>represented by the collection</a> is zero, abort these
    steps.</li>
 
+   <li><p>If the argument <var title="">index</var> is not a number, set it to zero.</li>
+   <!-- objects get converted to zero: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2828 -->
+   <!-- same for select.remove(), which calls this algorithm also:
+         http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2826
+         http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2825
+         http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2827
+     -->
+
    <li><p>If <var title="">index</var> is not a number greater than or equal to 0 and less than the
    number of nodes <a href=#represented-by-the-collection>represented by the collection</a>, abort these steps.</li>
-
    <!-- note that Web IDL converts 'a', NaN, -0.5, 0.5, and null to 0, and numbers in general
    truncate. so what we're checking against here in a way has very little to do with what's going on
    in the JS -->
@@ -44645,7 +44653,7 @@
   <a href=#htmloptionelement>HTMLOptionElement</a>? <a href=#dom-select-nameditem title=dom-select-namedItem>namedItem</a>(DOMString name);
   void <a href=#dom-select-add title=dom-select-add>add</a>((<a href=#htmloptionelement>HTMLOptionElement</a> or <a href=#htmloptgroupelement>HTMLOptGroupElement</a>) element, optional (<a href=#htmlelement>HTMLElement</a> or long)? before = null);
   void <a href=#dom-select-remove title=dom-select-remove>remove</a>(); // ChildNode overload
-  void <a href=#dom-select-remove title=dom-select-remove>remove</a>(long index);
+  void <a href=#dom-select-remove title=dom-select-remove>remove</a>((long or object?) index);
   <a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>setter creator</a> void (unsigned long index, <a href=#htmloptionelement>HTMLOptionElement</a>? option);
 
   readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-select-selectedoptions title=dom-select-selectedOptions>selectedOptions</a>;

Modified: source
===================================================================
--- source	2014-02-20 20:32:00 UTC (rev 8480)
+++ source	2014-02-20 22:10:30 UTC (rev 8481)
@@ -7249,7 +7249,7 @@
   <span data-x="dom-HTMLOptionsCollection-namedItem">legacycaller</span> <span>HTMLOptionElement</span>? (DOMString name);
   <span data-x="dom-HTMLOptionsCollection-setter">setter creator</span> void (unsigned long index, <span>HTMLOptionElement</span>? option);
   void <span data-x="dom-HTMLOptionsCollection-add">add</span>((<span>HTMLOptionElement</span> or <span>HTMLOptGroupElement</span>) element, optional (<span>HTMLElement</span> or long)? before = null);
-  void <span data-x="dom-HTMLOptionsCollection-remove">remove</span>(long index);
+  void <span data-x="dom-HTMLOptionsCollection-remove">remove</span>((long or object?) index);
            attribute long <span data-x="dom-HTMLOptionsCollection-selectedIndex">selectedIndex</span>;
 };</pre>
 
@@ -7337,6 +7337,7 @@
   data-x="dom-HTMLCollection-namedItem">namedItem()</code> method on the ancestor
   <code>HTMLCollection</code> interface.</p>
 
+<!--CLEANUP-->
   <p>When the user agent is to <dfn data-x="dom-HTMLOptionsCollection-setter">set the value of a new
   indexed property or set the value of an existing indexed property</dfn> for a given property index <var data-x="">index</var> to a new value <var
   data-x="">value</var>, it must run the following algorithm:</p>
@@ -7405,9 +7406,16 @@
    <li><p>If the number of nodes <span>represented by the collection</span> is zero, abort these
    steps.</li>
 
+   <li><p>If the argument <var data-x="">index</var> is not a number, set it to zero.</p></li>
+   <!-- objects get converted to zero: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2828 -->
+   <!-- same for select.remove(), which calls this algorithm also:
+         http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2826
+         http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2825
+         http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2827
+     -->
+
    <li><p>If <var data-x="">index</var> is not a number greater than or equal to 0 and less than the
    number of nodes <span>represented by the collection</span>, abort these steps.</p></li>
-
    <!-- note that Web IDL converts 'a', NaN, -0.5, 0.5, and null to 0, and numbers in general
    truncate. so what we're checking against here in a way has very little to do with what's going on
    in the JS -->
@@ -48909,7 +48917,7 @@
   <span>HTMLOptionElement</span>? <span data-x="dom-select-namedItem">namedItem</span>(DOMString name);
   void <span data-x="dom-select-add">add</span>((<span>HTMLOptionElement</span> or <span>HTMLOptGroupElement</span>) element, optional (<span>HTMLElement</span> or long)? before = null);
   void <span data-x="dom-select-remove">remove</span>(); // ChildNode overload
-  void <span data-x="dom-select-remove">remove</span>(long index);
+  void <span data-x="dom-select-remove">remove</span>((long or object?) index);
   <span data-x="dom-HTMLOptionsCollection-setter">setter creator</span> void (unsigned long index, <span>HTMLOptionElement</span>? option);
 
   readonly attribute <span>HTMLCollection</span> <span data-x="dom-select-selectedOptions">selectedOptions</span>;




More information about the Commit-Watchers mailing list