Skip to main content

Bug Tracker

Side navigation

#1163 closed bug (wontfix)

Opened May 10, 2007 04:49PM UTC

Closed May 23, 2007 12:51PM UTC

Last modified June 21, 2007 03:36AM UTC

oForm.elements problem in IE

Reported by: mattcopeland Owned by:
Priority: minor Milestone: 1.1.3
Component: core Version: 1.1.2
Keywords: Cc:
Blocked by: Blocking:
Description

I was trying to iterate over my form elements using something like:

$(oForm.elements).css({color:"#999999"});

This works in FF but not in IE.

I used the size method $(oForm.elements).size() and got the right number of elements in FF but only 1 element in IE.

It seems like FF gets a reference to the collection of elements while IE gets a reference to the form itself.

Attachments (0)
Change History (5)

Changed May 13, 2007 02:37AM UTC by brandon comment:1

The problem is the check for !a.nodeType in jQuery. Unfortunately, form.elements is essentially the form element and has a nodeType.

Changed May 13, 2007 04:03AM UTC by brandon comment:2

resolution: → fixed
status: newclosed

Fixed in Rev [1892]

Changed May 23, 2007 12:49PM UTC by brandon comment:3

resolution: fixed
status: closedreopened

I have rolled back the fix because passing in a form element is the same as passing in form.elements.

Changed May 23, 2007 12:51PM UTC by brandon comment:4

resolution: → wontfix
status: reopenedclosed

I'm marking this as wontfix but I'm providing a work around. Please make sure to call $.makeArray(form.elements) before passing it into $(). Unfortunately IE leaves us no choice since the form element == form.elements.

Changed May 23, 2007 07:46PM UTC by DanSwitzer2 comment:5

Just to clarify the issue, in IE 6 the "elements" property of a form is not a true array, but instead a pointer back to the original form object (which in IE can be treated like an array.)

This means in IE6, the following evaluates to true:

document.forms[0].elements == documents.forms[0]