durtto / datejs

Automatically exported from code.google.com/p/datejs
Other
0 stars 0 forks source link

jquery 1.4.2 serialization breaks with datejs #106

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. include jquery and datejs into a page
2. create an object: var myVar = {key: new Date()}
3. call alert( jQuery.param( myVar ) )

What is the expected output? What do you see instead?
When datejs is not included, it produces a url encoded string with url encoded 
date.
Instead an error is thrown saying that this.setHour is not a function.

What version of the product are you using? On what operating system?
1.0 Alpha-1 @date 2008-05-13 

Please provide any additional information below.
I guess it comes from the jQuery 1.4.2 new serialization system, as when I use 
ajaxSettings.traditional = true it works fine.

the serialization process tries to serialize every property, and if property is 
a function it is executed.
the way to read properties is for( .. in ...), so every function added to $D is 
executed.

Maybe it could be a nice thing not to extend the native Date object but to have 
a Datejs object instead, and have a config option to tell wether to extend 
native too.

Original issue reported on code.google.com by the.moue...@gmail.com on 4 Aug 2010 at 8:18

GoogleCodeExporter commented 9 years ago
Works correctly in the current build on my fork: 
https://github.com/abritinthebay/datejs/

Could also have partially been a bug in jQuery as an objects toString method 
should have been called if present.

Original comment by darkcr...@gmail.com on 15 Sep 2013 at 7:24