Side navigation
#11481 closed bug (invalid)
Opened March 16, 2012 01:21PM UTC
Closed March 18, 2012 03:46PM UTC
jQuery.param does not serialize Date objects correctly
Reported by: | JayAchTee | Owned by: | JayAchTee |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | misc | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When using deep serialization, JavaScript Date objects are not serialized correctly. They are skipped in the buildParams method "for (var name in obj)" code because they are typeof "object" but have no "name" property.
This bug was exposed by using Telerik's Kendo UI grid with server-side filtering enabled.
I tested using the following (near line 9048 of the unminified version) and it seems to resolve the issue:
if (obj instanceof Date)
{
add(prefix, obj);
}
else
{
for (var name in obj)
{
buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
}
}
Attachments (0)
Change History (3)
Changed March 16, 2012 01:27PM UTC by comment:1
owner: | → JayAchTee |
---|---|
status: | new → pending |
Changed March 18, 2012 10:59AM UTC by comment:2
_comment0: | It appears that jQuery v1.7.2pre Live from Git has this fixed! Changing to "jQuery.type( obj ) === "object"" works as expected! → 1332068641213836 |
---|---|
status: | pending → new |
It appears that jQuery v1.7.2pre Live from Git has this fixed! Changing to "jQuery.type( obj ) === "object"" works as expected!
Thanks for your help on this issue!
Changed March 18, 2012 03:46PM UTC by comment:3
component: | unfiled → misc |
---|---|
priority: | undecided → low |
resolution: | → invalid |
status: | new → closed |
Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.