MooTools 1.2 (and all previous instances of the library) unlink child
members of options to prevent class pollution. Consider:
var Widget = new Class({
  options: {
    fruits: {
      apples: 'red'
    }
  }
});
//imaging that we do not unlink options.fruits
var first = new Widget();
var second = new Widget();

first.options.fruits.apples = 'green';
//you have now changed fruits.apples for the second instance, too

MooTools 1.3 will fix this problem though. The sub-objects will inherit from
their parents without affecting existing instances.

-aaron

On Sun, Feb 1, 2009 at 5:56 AM, jtreitz (via Nabble) <
[email protected]<ml-user%[email protected]>
> wrote:

>
> Hey guys,
>
> Recently I ran into some trouble with classes having parents and
> childs. Seems to me that setOptions unlinks every object reference in
> the given options array? I'm pretty sure it is intended to do so, so
> my question is: why and what should I do instead?
>
> http://nopaste.ch/e9f8771226015cc.html
>
> Thank you
>
>          Johannes
>
>
> ------------------------------
>  View message @
> http://n2.nabble.com/Options-unlinks-object-references--tp2253849p2253849.html
> To start a new topic under MooTools Users, email
> [email protected]<ml-node%[email protected]>
> To unsubscribe from MooTools Users, click here< (link removed) >.
>
>
>


-----
The MooTools Tutorial:  http://www.mootorial.com www.mootorial.com 
Clientcide:  http://www.clientcide.com www.clientcide.com 
-- 
View this message in context: 
http://n2.nabble.com/Options-unlinks-object-references--tp2253849p2254937.html
Sent from the MooTools Users mailing list archive at Nabble.com.

Reply via email to