Open Bug 616735 Opened 14 years ago Updated 2 years ago

'FormElement' in document.forms.formName.elements wrongly returns false

Categories

(Firefox :: General, defect)

3.6 Branch
x86
Linux
defect

Tracking

()

UNCONFIRMED

People

(Reporter: brandonkirsch, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101026 SUSE/3.6.12-0.7.1 Firefox/3.6.12

In the following form snippet:

<form name="bugForm">
<input name="inputElement" value="some value">
</form>
<script>
alert(document.forms['bugForm'].elements['inputElement'].value); // "some value"
alert('inputElement' in document.forms['bugForm']); // false, expected true
</script>

I expect 'inputElement' in document.forms['bugForm'] to return true, but it returns false.  I have this problem with 3.6.12 on Linux/32-bit and have verified it also exists on Win7/64-bit Firefox 3.6.12 as well.

Reproducible: Always

Steps to Reproduce:
1. eval(alert('validInputName' in document.forms['validFormName'].elements));
2. Expect "true" since validInputName is a property of document.forms['validFormName'].elements
3. Get "false" instead.
Actual Results:  
Returns false.

Expected Results:  
Returns true.
Version: unspecified → 3.6 Branch
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.