Bug Tracker

Opened 14 years ago

Closed 12 years ago

#3965 closed bug (fixed)

serialize bug in IE

Reported by: jehinkle Owned by:
Priority: low Milestone: 1.4.4
Component: ajax Version: 1.3.1
Keywords: serialize ajaxrewrite expando Cc:
Blocked by: Blocking:

Description

when using .serialize(), if any input in your selection has an ID of 'length', serialize() will return a null value.

Attached is a simple demo of the issue. Run the html file in IE 7 and you will get an alert box with a no message. Rename the input to anything other than 'length' and it will alert the serialized string. No issues when running the page in FireFox

Attachments (1)

demo.htm (289 bytes) - added by jehinkle 14 years ago.
demo of bug

Download all attachments as: .zip

Change History (7)

Changed 14 years ago by jehinkle

Attachment: demo.htm added

demo of bug

comment:1 Changed 14 years ago by dmethvin

This fails in IE8 RC1 as well. The problem occurs in jQuery.makeArray. It is passed the form's elements collection and tries to get the length property, but ends up getting the input element with id="length" instead. As a result it doesn't return an array with the form elements.

This case even confuses the IE8 debugger! At the top of makeArray it shows the array.length==2 in the debugger, but as soon as the line i = array.length executes it shows the length as an HTMLInput element.

Grabbing the elements using a selector seems like a possible workaround, at least it worked for this particular case:

<  return this.elements ? jQuery.makeArray(this.elements) : this;
>  return this.elements ? jQuery.makeArray(jQuery(":input", this)) : this;

comment:2 Changed 13 years ago by dmethvin

Milestone: 1.3.21.4.3

comment:3 Changed 12 years ago by dmethvin

Milestone: 1.4.31.5
Status: newopen

comment:4 Changed 12 years ago by Rick Waldron

Keywords: ajaxrewrite added

comment:5 Changed 12 years ago by snover

Keywords: expando added
Milestone: 1.5
Priority: triviallow

comment:6 Changed 12 years ago by timmywil

Milestone: 1.4.4
Resolution: fixed
Status: openclosed

This bug no longer seems to be present. http://jsfiddle.net/timmywil/Jrxmy/

Note: See TracTickets for help on using tickets.