I can see why it is working the way it does, but it seems like a clear
and easily fixable bug to me.  $.extend() could be made aware of the
intrinsic JavaScript objects so that they are copied (i.e. recreated)
properly.


On Feb 5, 3:11 pm, Stephan Veigl <stephan.ve...@gmail.com> wrote:
> Hi,
>
> this is because jQuery creates anonymous objects for the clones and
> copies the object properties. For the Date object there are no public
> properties, so only the empty object hull is created.
>
> But you are right, not copying Dates correctly is a bit strange.
> If you disable the copy deep flag, your date will be in the clone, but
> in this case it's no clone, but a reference to the original date
> object.
>
> by(e)
> Stephan
>
> 2009/2/5 Tin <michael.leib...@gmail.com>:
>
>
>
>
>
> > Hi guys,
> > I'm trying to create a deep copy of an object with $.extend(true, {},
> > obj), but I've noticed that all of the dates get copied as a simple
> > Object with no properties.  Here's a sample code that demonstrates it:
>
> > var clone = $.extend(true, {}, {myDate:new Date()});
>
> > // clone.myDate returns {}
> > // clone.myDate.toString() -> [object Object]
>
> > Any ideas on why this is happening?

Reply via email to