Closed Bug 399434 Opened 17 years ago Closed 16 years ago

In javascript in the array form.elements the input image type are missing

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: aquilax, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4

In javascript using the array form.elements should returns all the inputs, textareas and selects inside the form, but from the input image elements are missing.

Reproducible: Always

Steps to Reproduce:
1.Navigate to http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_IMAGE.html
2.use this bookmarklet javascript:var text=""; var form=document.forms[1]; for(var num1=0;num1<form.elements.length;num1++) text+=form.elements[num1].type+" "+form.elements[num1].name+"\n"; alert(text);
3.
Actual Results:  
The form contains two input a text and an image ... but only the text is found!

Expected Results:  
Both elements presents in the form.elements array
Although your expectation is perfectly natural, it is not the way browsers work. It may have been an accidental omission to the official specification.

http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-76728479
|  elements of type HTMLCollection, readonly
|    Returns a collection of all form control 
|    elements in the form

(form.elements is not an array).
  
http://www.w3.org/TR/html401/interact/forms.html#h-17.2.1
 HTML defines the following control types:
 buttons, checkboxes, radio buttons, menus, text input, file select, hidden controls, object controls

The specification does not mention input elements being a 'form control' and, at least under the "form controls" section does not include input type="image".

It is too late to change the specification at this time.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.