i think $unlink is what you want:
var obj = {
values: {
foo: 'A',
bar: 'B',
},
alert: function(){
alert('hello world.');
}
};
var a = obj;
var b = $unlink(a);
a.values.foo = "i'm new";
b.values.bar = "new value";
console.dir(a.values);
console.dir(b.values);
On Oct 7, 2008, at 10:02, nutron wrote:
You need to be careful here. $merge recurses into objects, but if
those objects are Natives (like funcitons) they themselves contain
members that are also functions (like function.bind). This can lead
to an infinite loop.
On Tue, Oct 7, 2008 at 12:58 AM, Iván N Paz <ml-user
[EMAIL PROTECTED]> wrote:
clone?
On 10/6/08, jon <[EMAIL PROTECTED]> wrote:
>
> $merge doesn't copy and object's functions, is there a way to
copy an
> object better than using $merge?
> var copy=$merge(obj);
>
> thanks
>
--
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦
www.ivanicus.com
The MooTools Tutorial: www.mootorial.com CNET Clientside:
clientside.cnet.com
View this message in context: Re: copy an object
Sent from the MooTools Users mailing list archive at Nabble.com.
--
my blog: http://blog.kassens.net