[html5] r2979 - [] (0) Make it possible to do document.forms.f.r.value = 'b' to check the second [...]

whatwg at whatwg.org whatwg at whatwg.org
Fri Apr 24 18:31:48 PDT 2009


Author: ianh
Date: 2009-04-24 18:31:47 -0700 (Fri, 24 Apr 2009)
New Revision: 2979

Modified:
   index
   source
Log:
[] (0) Make it possible to do document.forms.f.r.value = 'b' to check the second radio button in <form name=f><input type=radio name=r value=a><input type=radio name=r value=b></form>

Modified: index
===================================================================
--- index	2009-04-24 09:49:45 UTC (rev 2978)
+++ index	2009-04-25 01:31:47 UTC (rev 2979)
@@ -39,7 +39,7 @@
   <div class=head>
    <p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
    <h1>HTML 5</h1>
-   <h2 class="no-num no-toc" id=draft-recommendation-—-date:-01-jan-1901>Draft Recommendation — 24 April 2009</h2>
+   <h2 class="no-num no-toc" id=draft-recommendation-—-date:-01-jan-1901>Draft Recommendation — 25 April 2009</h2>
    <p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <dl><dt>Multiple-page version:</dt>
@@ -6022,6 +6022,10 @@
   readonly attribute unsigned long <a href=#dom-htmlformcontrolscollection-length title=dom-HTMLFormControlsCollection-length>length</a>;
   [IndexGetter] <a href=#htmlelement>HTMLElement</a> <a href=#dom-htmlformcontrolscollection-item title=dom-HTMLFormControlsCollection-item>item</a>(in unsigned long index);
   [NameGetter] Object <a href=#dom-htmlformcontrolscollection-nameditem title=dom-HTMLFormControlsCollection-namedItem>namedItem</a>(in DOMString name);
+};
+
+interface <dfn id=radionodelist>RadioNodeList</dfn> : <span>NodeList</span> {
+          attribute DOMString <a href=#dom-radionodelist-value title=dom-RadioNodeList-value>value</a>;
 };</pre>
 
   <dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLFormControlsCollection-length><a href=#dom-htmlformcontrolscollection-length>length</a></code></dt>
@@ -6037,13 +6041,26 @@
    </dd>
 
    <dt><var title="">element</var> = <var title="">collection</var> . <code title=dom-HTMLFormControlsCollection-item><a href=#dom-htmlformcontrolscollection-item>namedItem</a></code>(<var title="">name</var>)</dt>
+   <dt><var title="">radioNodeList</var> = <var title="">collection</var> . <code title=dom-HTMLFormControlsCollection-item><a href=#dom-htmlformcontrolscollection-item>namedItem</a></code>(<var title="">name</var>)</dt>
    <dt><var title="">collection</var>[<var title="">name</var>]</dt>
    <dd>
     <p>Returns the item with ID or <code title=attr-fe-name><a href=#attr-fe-name>name</a></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 a <code><a href=#radionodelist>RadioNodeList</a></code> object containing all those elements is returned.</p>
     <p>Returns null if no element with that ID or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> could be found.</p>
    </dd>
 
+   <dt><var title="">radioNodeList</var> . <var title="">value</var> [ = <var title="">value</var> ]</dt>
+
+   <dd>
+
+    <p>Returns the value of the first checked radio button represented
+    by the object.</p>
+
+    <p>Can be set, to check the first radio button with the given
+    value represented by the object.</p>
+
+   </dd>
+
   </dl><div class=impl>
 
   <hr><p>The object's <span>indices of the supported indexed
@@ -6073,15 +6090,54 @@
    <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-fe-name><a href=#attr-fe-name>name</a></code> attribute equal to <var title="">name</var>, then return null and stop the algorithm.</li>
 
-   <!-- XXX should we return an HTMLCollection instead, like IE? -->
-   <li>Otherwise, create a <code>NodeList</code> object representing a
-   live view of the <code><a href=#htmlformcontrolscollection-0>HTMLFormControlsCollection</a></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><a href=#the-id-attribute>id</a></code> attribute or a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute equal to <var title="">name</var>. The nodes in the <code>NodeList</code> object
-   must be sorted in <a href=#tree-order>tree order</a>.</li>
+   <li>Otherwise, create a <code><a href=#radionodelist>RadioNodeList</a></code> object
+   representing a live view of the
+   <code><a href=#htmlformcontrolscollection-0>HTMLFormControlsCollection</a></code> object, further filtered so
+   that the only nodes in the <code><a href=#radionodelist>RadioNodeList</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-fe-name><a href=#attr-fe-name>name</a></code> attribute equal to <var title="">name</var>. The nodes in the <code><a href=#radionodelist>RadioNodeList</a></code>
+   object must be sorted in <a href=#tree-order>tree order</a>.</li>
 
-   <li>Return that <code>NodeList</code> object.</li>
+   <li>Return that <code><a href=#radionodelist>RadioNodeList</a></code> object.</li>
 
+  </ol><hr><p>A members of the <code><a href=#radionodelist>RadioNodeList</a></code> interface inherited
+  from the <code>NodeList</code> interface must behave as they would
+  on a <code>NodeList</code> object.</p>
+
+  <p>The <dfn id=dom-radionodelist-value title=dom-RadioNodeList-value><code>value</code></dfn>
+  DOM attribute on the <code><a href=#radionodelist>RadioNodeList</a></code> object, on getting,
+  must return the value returned by running the following steps:</p>
+
+  <ol><li><p>Let <var title="">element</var> be the first element in
+   <a href=#tree-order>tree order</a> represented by the
+   <code><a href=#radionodelist>RadioNodeList</a></code> object that is an <code><a href=#the-input-element>input</a></code>
+   element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute
+   is in the <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a>
+   state and whose <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>
+   is true. Otherwise, let it be null.</li>
+
+   <li><p>If <var title="">element</var> is null, or if it is an
+   element with no <code title=attr-input-value><a href=#attr-input-value>value</a></code>
+   attribute, return the empty string.</li>
+
+   <li><p>Otherwise, return the value of <var title="">element</var>'s
+   <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute.</li>
+
+  </ol><p>On setting, the <code title=dom-RadioNodeList-value><a href=#dom-radionodelist-value>value</a></code> DOM attribute must run
+  the following steps:</p>
+
+  <ol><li><p>Let <var title="">element</var> be the first element in
+   <a href=#tree-order>tree order</a> represented by the
+   <code><a href=#radionodelist>RadioNodeList</a></code> object that is an <code><a href=#the-input-element>input</a></code>
+   element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute
+   is in the <a href=#radio-button-state title=attr-input-type-radio>Radio Button</a>
+   state and whose <code title=attr-input-value><a href=#attr-input-value>value</a></code> content
+   attribute is present and equal to the new value, if any. Otherwise,
+   let it be null.</li>
+
+   <li><p>If <var title="">element</var> is not null, then set its
+   <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> to true.</p>
+
   </ol><!--
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E...%0A%3Cform%20name%3D%22a%22%3E%3Cinput%20id%3D%22x%22%20name%3D%22y%22%3E%3Cinput%20name%3D%22x%22%20id%3D%22y%22%3E%3C/form%3E%0A%3Cscript%3E%0A%20%20var%20x%3B%0A%20%20w%28x%20%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20x%5B0%5D.parentNode.removeChild%28x%5B0%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20w%28x%20%3D%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%3C/script%3E%0A
 --></div>

Modified: source
===================================================================
--- source	2009-04-24 09:49:45 UTC (rev 2978)
+++ source	2009-04-25 01:31:47 UTC (rev 2979)
@@ -5948,6 +5948,10 @@
   readonly attribute unsigned long <span title="dom-HTMLFormControlsCollection-length">length</span>;
   [IndexGetter] <span>HTMLElement</span> <span title="dom-HTMLFormControlsCollection-item">item</span>(in unsigned long index);
   [NameGetter] Object <span title="dom-HTMLFormControlsCollection-namedItem">namedItem</span>(in DOMString name);
+};
+
+interface <dfn>RadioNodeList</dfn> : <span>NodeList</span> {
+          attribute DOMString <span title="dom-RadioNodeList-value">value</span>;
 };</pre>
 
   <dl class="domintro">
@@ -5965,13 +5969,26 @@
    </dd>
 
    <dt><var title="">element</var> = <var title="">collection</var> . <code title="dom-HTMLFormControlsCollection-item">namedItem</code>(<var title="">name</var>)</dt>
+   <dt><var title="">radioNodeList</var> = <var title="">collection</var> . <code title="dom-HTMLFormControlsCollection-item">namedItem</code>(<var title="">name</var>)</dt>
    <dt><var title="">collection</var>[<var title="">name</var>]</dt>
    <dd>
     <p>Returns the item with ID or <code title="attr-fe-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 a <code>RadioNodeList</code> object containing all those elements is returned.</p>
     <p>Returns null if no element with that ID or <code title="attr-fe-name">name</code> could be found.</p>
    </dd>
 
+   <dt><var title="">radioNodeList</var> . <var title="">value</var> [ = <var title="">value</var> ]</dt>
+
+   <dd>
+
+    <p>Returns the value of the first checked radio button represented
+    by the object.</p>
+
+    <p>Can be set, to check the first radio button with the given
+    value represented by the object.</p>
+
+   </dd>
+
   </dl>
 
   <div class="impl">
@@ -6020,20 +6037,68 @@
    title="attr-fe-name">name</code> attribute equal to <var
    title="">name</var>, then return null and stop the algorithm.</li>
 
-   <!-- XXX should we return an HTMLCollection instead, like IE? -->
-   <li>Otherwise, create a <code>NodeList</code> object representing a
-   live view of the <code>HTMLFormControlsCollection</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-fe-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>Otherwise, create a <code>RadioNodeList</code> object
+   representing a live view of the
+   <code>HTMLFormControlsCollection</code> object, further filtered so
+   that the only nodes in the <code>RadioNodeList</code> object are
+   those that have either an <code title="attr-id">id</code> attribute
+   or a <code title="attr-fe-name">name</code> attribute equal to <var
+   title="">name</var>. The nodes in the <code>RadioNodeList</code>
+   object must be sorted in <span>tree order</span>.</li>
 
-   <li>Return that <code>NodeList</code> object.</li>
+   <li>Return that <code>RadioNodeList</code> object.</li>
 
   </ol>
 
+  <hr>
+
+  <p>A members of the <code>RadioNodeList</code> interface inherited
+  from the <code>NodeList</code> interface must behave as they would
+  on a <code>NodeList</code> object.</p>
+
+  <p>The <dfn title="dom-RadioNodeList-value"><code>value</code></dfn>
+  DOM attribute on the <code>RadioNodeList</code> object, on getting,
+  must return the value returned by running the following steps:</p>
+
+  <ol>
+
+   <li><p>Let <var title="">element</var> be the first element in
+   <span>tree order</span> represented by the
+   <code>RadioNodeList</code> object that is an <code>input</code>
+   element whose <code title="attr-input-type">type</code> attribute
+   is in the <span title="attr-input-type-radio">Radio Button</span>
+   state and whose <span title="concept-fe-checked">checkedness</span>
+   is true. Otherwise, let it be null.</p></li>
+
+   <li><p>If <var title="">element</var> is null, or if it is an
+   element with no <code title="attr-input-value">value</code>
+   attribute, return the empty string.</p></li>
+
+   <li><p>Otherwise, return the value of <var title="">element</var>'s
+   <code title="attr-input-value">value</code> attribute.</p></li>
+
+  </ol>
+
+  <p>On setting, the <code
+  title="dom-RadioNodeList-value">value</code> DOM attribute must run
+  the following steps:</p>
+
+  <ol>
+
+   <li><p>Let <var title="">element</var> be the first element in
+   <span>tree order</span> represented by the
+   <code>RadioNodeList</code> object that is an <code>input</code>
+   element whose <code title="attr-input-type">type</code> attribute
+   is in the <span title="attr-input-type-radio">Radio Button</span>
+   state and whose <code title="attr-input-value">value</code> content
+   attribute is present and equal to the new value, if any. Otherwise,
+   let it be null.</p></li>
+
+   <li><p>If <var title="">element</var> is not null, then set its
+   <span title="concept-fe-checked">checkedness</span> to true.</p>
+
+  </ol>
+
 <!--
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E...%0A%3Cform%20name%3D%22a%22%3E%3Cinput%20id%3D%22x%22%20name%3D%22y%22%3E%3Cinput%20name%3D%22x%22%20id%3D%22y%22%3E%3C/form%3E%0A%3Cscript%3E%0A%20%20var%20x%3B%0A%20%20w%28x%20%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20x%5B0%5D.parentNode.removeChild%28x%5B0%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20w%28x%20%3D%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%3C/script%3E%0A
 -->




More information about the Commit-Watchers mailing list