Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#1163 closed bug (wontfix)

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.

Change History (5)

comment:1 Changed 13 years ago by brandon

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

comment:2 Changed 13 years ago by brandon

Resolution: fixed
Status: newclosed

Fixed in Rev [1892]

comment:3 Changed 13 years ago by brandon

Resolution: fixed
Status: closedreopened

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

comment:4 Changed 13 years ago by brandon

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.

comment:5 Changed 13 years ago by DanSwitzer2

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]

Note: See TracTickets for help on using tickets.