When an input element has a name which is an number, it should still be accessible via form.elements. e.g. <input name="2"></input> should be accessible via form.elements[2]. See https://html.spec.whatwg.org/multipage/forms.html#dom-form-elements https://html.spec.whatwg.org/multipage/infrastructure.html#htmlformcontrolscollection This bug was found by the newly added test: LayoutTests/http/tests/w3c/html/semantics/forms/the-form-element/form-elements-matches.html
<rdar://problem/22589952>
Both Firefox and Chrome pass this test.
Note Note that if an indexed property getter or setter is specified using an operation with an identifier, then indexing an object with an integer that is not a supported property index does not necessarily elicit the same behavior as invoking the operation with that index. The actual behavior in this case is language binding specific. In the ECMAScript language binding, a regular property lookup is done. For example, take the following IDL: IDL interface A { getter DOMString toWord(unsigned long index); }; Assume that an object implementing A has supported property indices in the range 0 ≤ index < 2. Also assume that toWord is defined to return its argument converted into an English word. The behavior when invoking the operation with an out of range index is different from indexing the object directly: ECMAScript var a = getA(); a.toWord(0); // Evalautes to "zero". a[0]; // Also evaluates to "zero". a.toWord(5); // Evaluates to "five". a[5]; // Evaluates to undefined, since there is no property "5".
Firefox and Chrome follow the Web IDL specification here.
Created attachment 263986 [details] Patch
W3C test: http://w3c-test.org/html/semantics/forms/the-form-element/form-elements-matches.html
Comment on attachment 263986 [details] Patch Clearing flags on attachment: 263986 Committed r191587: <http://trac.webkit.org/changeset/191587>
All reviewed patches have been landed. Closing bug.