Bug Tracker

Modify

Ticket #3965 (closed bug: fixed)

Opened 4 years ago

Last modified 2 years ago

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:
Blocking: Blocked by:

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

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

Change History

Changed 4 years ago by jehinkle

demo of bug

comment:1 Changed 4 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 3 years ago by dmethvin

  • Milestone changed from 1.3.2 to 1.4.3

comment:3 Changed 3 years ago by dmethvin

  • Status changed from new to open
  • Milestone changed from 1.4.3 to 1.5

comment:4 Changed 2 years ago by rwaldron

  • Keywords serialize,ajaxrewrite added; serialize removed

comment:5 Changed 2 years ago by snover

  • Keywords serialize ajaxrewrite expando added; serialize,ajaxrewrite removed
  • Priority changed from trivial to low
  • Milestone 1.5 deleted

comment:6 Changed 2 years ago by timmywil

  • Status changed from open to closed
  • Resolution set to fixed
  • Milestone set to 1.4.4

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.