Skip to content
Browse files

[giow] (2) Try to make the named getter on HTMLFormElement more Web-c…

…ompatible.

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=13776

git-svn-id: http://svn.whatwg.org/webapps@6727 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent d948c71 commit 6a685244a6d816d0d2f36dce302d9011b5ba3b03 @Hixie Hixie committed
Showing with 137 additions and 88 deletions.
  1. +40 −25 complete.html
  2. +40 −25 index
  3. +57 −38 source
View
65 complete.html
@@ -42544,8 +42544,11 @@ <h4 id=categories><span class=secno>4.10.2 </span>Categories</h4>
<dd>
- <p>Returns the form control in the form with the given <a href=#concept-id title=concept-id>ID</a> or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> (excluding image buttons for
- historical reasons).</p>
+ <p>Returns the form control (or, if there are several, a
+ <code><a href=#nodelist>NodeList</a></code> of the form controls) in the form with the
+ given <a href=#concept-id title=concept-id>ID</a> or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> (excluding image buttons for
+ historical reasons); or, if there are none, returns the
+ <code><a href=#the-img-element>img</a></code> element with the given ID.</p>
<p>Once an element has been referenced using a particular name,
that name will continue being available as a way to reference that
@@ -42618,41 +42621,44 @@ <h4 id=categories><span class=secno>4.10.2 </span>Categories</h4>
the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> collection, when
invoked with the given index as its argument.</p>
- <p>Each <code><a href=#the-form-element>form</a></code> element has a mapping of names to elements
+ <hr><!-- Welcome to crazy town. Population: The Web. --><p>Each <code><a href=#the-form-element>form</a></code> element has a mapping of names to elements
called the <dfn id=past-names-map>past names map</dfn>. It is used to persist names of
controls even when they change names.</p>
- <p>The <a href=#supported-property-names>supported property names</a> are the union of the
- names currently supported by the object returned by the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute, and the names
- currently in the <a href=#past-names-map>past names map</a>.</p>
+ <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-fe-name><a href=#attr-fe-name>name</a></code> attributes of all the <a href=#category-listed title=category-listed>listed elements</a> and <code><a href=#the-img-element>img</a></code>
+ elements that are descendants of the <code><a href=#the-form-element>form</a></code> element, and
+ all the names currently in the <a href=#past-names-map>past names map</a>.</p>
<p>When a <code><a href=#the-form-element>form</a></code> element is <dfn id=dom-form-nameditem title=dom-form-namedItem>indexed for named property
retrieval</dfn>, the user agent must run the following steps:</p>
- <ol><li>
+ <ol><li><p>Let <var title="">candidates</var> be a <a href=#live>live</a>
+ <code><a href=#nodelist>NodeList</a></code> object containing all the <a href=#category-listed title=category-listed>listed elements</a> that are descendants
+ of the <code><a href=#the-form-element>form</a></code> element and 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>, in <a href=#tree-order>tree order</a>.</li>
- <p>If <var title="">name</var> is one of the <a href=#supported-property-names>supported
- property names</a> of the object returned by the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute, then run
- these substeps:</p>
+ <li><p>If <var title="">candidates</var> is empty, let <var title="">candidates</var> be a <a href=#live>live</a>
+ <code><a href=#nodelist>NodeList</a></code> object containing all the <code><a href=#the-img-element>img</a></code>
+ elements that are descendants of the <code><a href=#the-form-element>form</a></code> element and
+ that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a
+ <code title=attr-img-name><a href=#attr-img-name>name</a></code> attribute equal to <var title="">name</var>, in <a href=#tree-order>tree order</a>.</li>
- <ol><li><p>Let <var title="">candidate</var> be the object returned
- by the <code title=dom-HTMLFormControlsCollection-namedItem><a href=#dom-htmlformcontrolscollection-nameditem>namedItem()</a></code>
- method on the object returned by the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute when passed
- the <var title="">name</var> argument.</li>
+ <li><p>If <var title="">candidates</var> is empty, <var title="">name</var> is the name of one of the entries in the
+ <code><a href=#the-form-element>form</a></code> element's <a href=#past-names-map>past names map</a>: return the
+ object associated with <var title="">name</var> in that
+ map.</li>
- <li><p>If <var title="">candidate</var> is an element, then add a
- mapping from <var title="">name</var> to <var title="">candidate</var> in the <code><a href=#the-form-element>form</a></code> element's
- <a href=#past-names-map>past names map</a>, replacing the previous entry with
- the same name, if any.</li>
+ <li><p>If <var title="">candidates</var> contains more than one
+ node, return <var title="">candidates</var> and abort these
+ steps.</li>
- <li><p>Return <var title="">candidate</var> and abort these
- steps.</li>
+ <li><p>Otherwise, <var title="">candidates</var> contains exactly
+ one node. Add a mapping from <var title="">name</var> to the node
+ in <var title="">candidates</var> in the <code><a href=#the-form-element>form</a></code> element's
+ <a href=#past-names-map>past names map</a>, replacing the previous entry with the
+ same name, if any.</li>
- </ol></li>
-
- <li><p>Otherwise, <var title="">name</var> is the name of one of
- the entries in the <code><a href=#the-form-element>form</a></code> element's <a href=#past-names-map>past names
- map</a>: return the object associated with <var title="">name</var> in that map.</li>
+ <li><p>Return the node in <var title="">candidates</var>.</li>
</ol><p>If an element listed in the <code><a href=#the-form-element>form</a></code> element's <a href=#past-names-map>past
names map</a> is removed from the <code><a href=#document>Document</a></code>, then its
@@ -42678,8 +42684,17 @@ <h4 id=categories><span class=secno>4.10.2 </span>Categories</h4>
of writing, Safari returned the first element, Firefox returned
null (as we do), and IE7 returned the original collection:
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Cform%20action%3D%22%2F%22%3E%3Cinput%20name%3Da%20id%3Dfirst%3E%3Cinput%20name%3Da%20id%3Dsecond%3E%3C%2Fform%3E%0A%3Cscript%3E%0A%20w%28document.forms[0].a%29%3B%0A%20document.getElementsByTagName%28%27input%27%29[0].name%20%3D%20%27b%27%3B%0A%20document.getElementsByTagName%28%27input%27%29[1].name%20%3D%20%27b%27%3B%0A%20w%28document.forms[0].length%29%3B%0A%20w%28document.forms[0].a.id%29%3B%0A%3C%2Fscript%3E
+
+ In addition, the <img> fallback nonsense is similarly here for
+ legacy reasons. As is the exclusion of <input type=image>.
+
+ Also, check this out:
+ http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1220
+
-->
+ <!-- Now leaving crazy town. -->
+
<hr><p>The <dfn id=dom-form-submit title=dom-form-submit><code>submit()</code></dfn>
method, when invoked, must <a href=#concept-form-submit title=concept-form-submit>submit</a> the <code><a href=#the-form-element>form</a></code>
element from the <code><a href=#the-form-element>form</a></code> element itself, with the <var title="">submitted from <code title=dom-form-submit><a href=#dom-form-submit>submit()</a></code> method</var> flag set.</p>
View
65 index
@@ -42544,8 +42544,11 @@ interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement>H
<dd>
- <p>Returns the form control in the form with the given <a href=#concept-id title=concept-id>ID</a> or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> (excluding image buttons for
- historical reasons).</p>
+ <p>Returns the form control (or, if there are several, a
+ <code><a href=#nodelist>NodeList</a></code> of the form controls) in the form with the
+ given <a href=#concept-id title=concept-id>ID</a> or <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> (excluding image buttons for
+ historical reasons); or, if there are none, returns the
+ <code><a href=#the-img-element>img</a></code> element with the given ID.</p>
<p>Once an element has been referenced using a particular name,
that name will continue being available as a way to reference that
@@ -42618,41 +42621,44 @@ interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement>H
the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> collection, when
invoked with the given index as its argument.</p>
- <p>Each <code><a href=#the-form-element>form</a></code> element has a mapping of names to elements
+ <hr><!-- Welcome to crazy town. Population: The Web. --><p>Each <code><a href=#the-form-element>form</a></code> element has a mapping of names to elements
called the <dfn id=past-names-map>past names map</dfn>. It is used to persist names of
controls even when they change names.</p>
- <p>The <a href=#supported-property-names>supported property names</a> are the union of the
- names currently supported by the object returned by the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute, and the names
- currently in the <a href=#past-names-map>past names map</a>.</p>
+ <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-fe-name><a href=#attr-fe-name>name</a></code> attributes of all the <a href=#category-listed title=category-listed>listed elements</a> and <code><a href=#the-img-element>img</a></code>
+ elements that are descendants of the <code><a href=#the-form-element>form</a></code> element, and
+ all the names currently in the <a href=#past-names-map>past names map</a>.</p>
<p>When a <code><a href=#the-form-element>form</a></code> element is <dfn id=dom-form-nameditem title=dom-form-namedItem>indexed for named property
retrieval</dfn>, the user agent must run the following steps:</p>
- <ol><li>
+ <ol><li><p>Let <var title="">candidates</var> be a <a href=#live>live</a>
+ <code><a href=#nodelist>NodeList</a></code> object containing all the <a href=#category-listed title=category-listed>listed elements</a> that are descendants
+ of the <code><a href=#the-form-element>form</a></code> element and 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>, in <a href=#tree-order>tree order</a>.</li>
- <p>If <var title="">name</var> is one of the <a href=#supported-property-names>supported
- property names</a> of the object returned by the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute, then run
- these substeps:</p>
+ <li><p>If <var title="">candidates</var> is empty, let <var title="">candidates</var> be a <a href=#live>live</a>
+ <code><a href=#nodelist>NodeList</a></code> object containing all the <code><a href=#the-img-element>img</a></code>
+ elements that are descendants of the <code><a href=#the-form-element>form</a></code> element and
+ that have either an <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute or a
+ <code title=attr-img-name><a href=#attr-img-name>name</a></code> attribute equal to <var title="">name</var>, in <a href=#tree-order>tree order</a>.</li>
- <ol><li><p>Let <var title="">candidate</var> be the object returned
- by the <code title=dom-HTMLFormControlsCollection-namedItem><a href=#dom-htmlformcontrolscollection-nameditem>namedItem()</a></code>
- method on the object returned by the <code title=dom-form-elements><a href=#dom-form-elements>elements</a></code> attribute when passed
- the <var title="">name</var> argument.</li>
+ <li><p>If <var title="">candidates</var> is empty, <var title="">name</var> is the name of one of the entries in the
+ <code><a href=#the-form-element>form</a></code> element's <a href=#past-names-map>past names map</a>: return the
+ object associated with <var title="">name</var> in that
+ map.</li>
- <li><p>If <var title="">candidate</var> is an element, then add a
- mapping from <var title="">name</var> to <var title="">candidate</var> in the <code><a href=#the-form-element>form</a></code> element's
- <a href=#past-names-map>past names map</a>, replacing the previous entry with
- the same name, if any.</li>
+ <li><p>If <var title="">candidates</var> contains more than one
+ node, return <var title="">candidates</var> and abort these
+ steps.</li>
- <li><p>Return <var title="">candidate</var> and abort these
- steps.</li>
+ <li><p>Otherwise, <var title="">candidates</var> contains exactly
+ one node. Add a mapping from <var title="">name</var> to the node
+ in <var title="">candidates</var> in the <code><a href=#the-form-element>form</a></code> element's
+ <a href=#past-names-map>past names map</a>, replacing the previous entry with the
+ same name, if any.</li>
- </ol></li>
-
- <li><p>Otherwise, <var title="">name</var> is the name of one of
- the entries in the <code><a href=#the-form-element>form</a></code> element's <a href=#past-names-map>past names
- map</a>: return the object associated with <var title="">name</var> in that map.</li>
+ <li><p>Return the node in <var title="">candidates</var>.</li>
</ol><p>If an element listed in the <code><a href=#the-form-element>form</a></code> element's <a href=#past-names-map>past
names map</a> is removed from the <code><a href=#document>Document</a></code>, then its
@@ -42678,8 +42684,17 @@ interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement>H
of writing, Safari returned the first element, Firefox returned
null (as we do), and IE7 returned the original collection:
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Cform%20action%3D%22%2F%22%3E%3Cinput%20name%3Da%20id%3Dfirst%3E%3Cinput%20name%3Da%20id%3Dsecond%3E%3C%2Fform%3E%0A%3Cscript%3E%0A%20w%28document.forms[0].a%29%3B%0A%20document.getElementsByTagName%28%27input%27%29[0].name%20%3D%20%27b%27%3B%0A%20document.getElementsByTagName%28%27input%27%29[1].name%20%3D%20%27b%27%3B%0A%20w%28document.forms[0].length%29%3B%0A%20w%28document.forms[0].a.id%29%3B%0A%3C%2Fscript%3E
+
+ In addition, the <img> fallback nonsense is similarly here for
+ legacy reasons. As is the exclusion of <input type=image>.
+
+ Also, check this out:
+ http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1220
+
-->
+ <!-- Now leaving crazy town. -->
+
<hr><p>The <dfn id=dom-form-submit title=dom-form-submit><code>submit()</code></dfn>
method, when invoked, must <a href=#concept-form-submit title=concept-form-submit>submit</a> the <code><a href=#the-form-element>form</a></code>
element from the <code><a href=#the-form-element>form</a></code> element itself, with the <var title="">submitted from <code title=dom-form-submit><a href=#dom-form-submit>submit()</a></code> method</var> flag set.</p>
View
95 source
@@ -47430,13 +47430,17 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
<dd>
- <p>Returns the form control in the form with the given <span title="concept-id">ID</span> or <code
+ <p>Returns the form control (or, if there are several, a
+ <code>NodeList</code> of the form controls) in the form with the
+ given <span title="concept-id">ID</span> or <code
title="attr-fe-name">name</code> (excluding image buttons for
- historical reasons).</p>
+ historical reasons); or, if there are none, returns the
+ <code>img</code> element with the given ID.</p>
<p>Once an element has been referenced using a particular name,
that name will continue being available as a way to reference that
- element in this method, even if the element's actual <span title="concept-id">ID</span> or <code
+ element in this method, even if the element's actual <span
+ title="concept-id">ID</span> or <code
title="attr-fe-name">name</code> changes, for as long as the
element remains in the <code>Document</code>.</p>
@@ -47520,14 +47524,20 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
the <code title="dom-form-elements">elements</code> collection, when
invoked with the given index as its argument.</p>
+ <hr>
+
+ <!-- Welcome to crazy town. Population: The Web. -->
+
<p>Each <code>form</code> element has a mapping of names to elements
called the <dfn>past names map</dfn>. It is used to persist names of
controls even when they change names.</p>
- <p>The <span>supported property names</span> are the union of the
- names currently supported by the object returned by the <code
- title="dom-form-elements">elements</code> attribute, and the names
- currently in the <span>past names map</span>.</p>
+ <p>The <span>supported property names</span> consist of the values
+ of all the <code title="attr-id">id</code> and <code
+ title="attr-fe-name">name</code> attributes of all the <span
+ title="category-listed">listed elements</span> and <code>img</code>
+ elements that are descendants of the <code>form</code> element, and
+ all the names currently in the <span>past names map</span>.</p>
<p>When a <code>form</code> element is <dfn
title="dom-form-namedItem">indexed for named property
@@ -47535,39 +47545,39 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
<ol>
- <li>
-
- <p>If <var title="">name</var> is one of the <span>supported
- property names</span> of the object returned by the <code
- title="dom-form-elements">elements</code> attribute, then run
- these substeps:</p>
-
- <ol>
-
- <li><p>Let <var title="">candidate</var> be the object returned
- by the <code
- title="dom-HTMLFormControlsCollection-namedItem">namedItem()</code>
- method on the object returned by the <code
- title="dom-form-elements">elements</code> attribute when passed
- the <var title="">name</var> argument.</p></li>
-
- <li><p>If <var title="">candidate</var> is an element, then add a
- mapping from <var title="">name</var> to <var
- title="">candidate</var> in the <code>form</code> element's
- <span>past names map</span>, replacing the previous entry with
- the same name, if any.</p></li>
-
- <li><p>Return <var title="">candidate</var> and abort these
- steps.</p></li>
-
- </ol>
+ <li><p>Let <var title="">candidates</var> be a <span>live</span>
+ <code>NodeList</code> object containing all the <span
+ title="category-listed">listed elements</span> that are descendants
+ of the <code>form</code> element and 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>, in <span>tree order</span>.</p></li>
+
+ <li><p>If <var title="">candidates</var> is empty, let <var
+ title="">candidates</var> be a <span>live</span>
+ <code>NodeList</code> object containing all the <code>img</code>
+ elements that are descendants of the <code>form</code> element and
+ that have either an <code title="attr-id">id</code> attribute or a
+ <code title="attr-img-name">name</code> attribute equal to <var
+ title="">name</var>, in <span>tree order</span>.</p></li>
+
+ <li><p>If <var title="">candidates</var> is empty, <var
+ title="">name</var> is the name of one of the entries in the
+ <code>form</code> element's <span>past names map</span>: return the
+ object associated with <var title="">name</var> in that
+ map.</p></li>
+
+ <li><p>If <var title="">candidates</var> contains more than one
+ node, return <var title="">candidates</var> and abort these
+ steps.</p></li>
- </li>
+ <li><p>Otherwise, <var title="">candidates</var> contains exactly
+ one node. Add a mapping from <var title="">name</var> to the node
+ in <var title="">candidates</var> in the <code>form</code> element's
+ <span>past names map</span>, replacing the previous entry with the
+ same name, if any.</p></li>
- <li><p>Otherwise, <var title="">name</var> is the name of one of
- the entries in the <code>form</code> element's <span>past names
- map</span>: return the object associated with <var
- title="">name</var> in that map.</p></li>
+ <li><p>Return the node in <var title="">candidates</var>.</p></li>
</ol>
@@ -47595,8 +47605,17 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
of writing, Safari returned the first element, Firefox returned
null (as we do), and IE7 returned the original collection:
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Cform%20action%3D%22%2F%22%3E%3Cinput%20name%3Da%20id%3Dfirst%3E%3Cinput%20name%3Da%20id%3Dsecond%3E%3C%2Fform%3E%0A%3Cscript%3E%0A%20w%28document.forms[0].a%29%3B%0A%20document.getElementsByTagName%28%27input%27%29[0].name%20%3D%20%27b%27%3B%0A%20document.getElementsByTagName%28%27input%27%29[1].name%20%3D%20%27b%27%3B%0A%20w%28document.forms[0].length%29%3B%0A%20w%28document.forms[0].a.id%29%3B%0A%3C%2Fscript%3E
+
+ In addition, the <img> fallback nonsense is similarly here for
+ legacy reasons. As is the exclusion of <input type=image>.
+
+ Also, check this out:
+ http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1220
+
-->
+ <!-- Now leaving crazy town. -->
+
<hr>
<p>The <dfn title="dom-form-submit"><code>submit()</code></dfn>

0 comments on commit 6a68524

Please sign in to comment.
Something went wrong with that request. Please try again.