PMJI, I'm confused, (and I'm still a js noob too). I don't see $.extends() documented anywhere.
That's a typo, right, it should be $.extend()? Just checking <s>. **--** Steve On Aug 11, 4:52 pm, Daniel Friesen <nadir.seen.f...@gmail.com> wrote: > jQuery does reproduce loops: > > var father = { > child : {}} > > father.child.father = father; > $.extends( {}, father ) > > The problem here is you are telling jQuery to recurse into things it > shouldn't be recursing into. > > $.extends( true, .. ); is for when you want to duplicate nested objects, > rather than reference the same objects. > By definition, you are asking jQuery to: > Take {} > Take the keys in father: > for the child key: > create an object to make a duplicate using and place that onto {}.child > recurse into child: > for the father key: > create an object to make a duplicate using and place that onto > child.father > recurse into father: > for the child key: > create an object to make a duplicate using and place > that onto father.child > recurse into child: > ... > > There is no problem here, jQuery is following your orders just as you > give them. > > If jQuery were to try and track circular references it would: > A) Make .extends extremely inefficient because it would have to store > just about everything it touches and make sure it doesn't recurse > B) No longer create duplicate objects as it was told to > > ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name] > > ludovic wrote: > > Hi, > > I've got loops in my objects relations. Example : > > > var father = { > > child : {} > > } > > > father.child.father = father; > > > $.extends( true, {}, father ) causes a infinite loop. > > > Jquery should reproduce loops. > > > Regards, > > Ludovic > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---