If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

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

RESOLVED INVALID

Status

()

Firefox
General
RESOLVED INVALID
10 years ago
9 years ago

People

(Reporter: Aquila, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
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

Comment 1

9 years ago
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
Last Resolved: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.