look here
http://docs.jquery.com/Utilities/jQuery.extend#deeptargetobject1objectN

<http://docs.jquery.com/Utilities/jQuery.extend#deeptargetobject1objectN>the
first argument is the deep copy option.
check it out

On Mon, Sep 7, 2009 at 12:36 PM, roydukkey <royduk...@gmail.com> wrote:

> Thanks, that worked. But how did you know this, I can't find it
> documented anywhere?
>
> On Sep 6, 5:16 am, 月讀 <keyoft...@gmail.com> wrote:
> > o = $.extend(true, {}, d, s};
> >
> > On Sun, Sep 6, 2009 at 7:50 AM, roydukkey <royduk...@gmail.com> wrote:
> >
> > > Is there a better way to extend object with internal objects?
> >
> > > $.fn.bestShow = function(s) {
> > >        var d = {
> > >                width: 0,
> > >                height: 0,
> > >                order: "numeric",
> > >                orderBy: "",
> > >                animation: {
> > >                        type: "fade",
> > >                        delay: 5000,
> > >                        speed: 2000,
> > >                        overlay: false
> > >                },
> > >                controls:       {
> > >                        numeric: 0,
> > >                        next: false,
> > >                        play: false,
> > >                        stop: false,
> > >                        prev: false
> > >                }
> > >        };
> >
> > >        o = $.extend({},d,s);
> >
> > >        if (typeof(s) != 'undefined') {
> > >                if (typeof(s.animation) != 'undefined') o.animation =
> > > $.extend({},
> > > d.animation, s.animation);
> > >                if (typeof(s.controls) != 'undefined') o.controls =
> > > $.extend({},
> > > d.controls, s.controls);
> > >        }
>

Reply via email to