Ticket #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: | |
| 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
Change History
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:3 Changed 3 years ago by dmethvin
- Status changed from new to open
- Milestone changed from 1.4.3 to 1.5
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.


demo of bug