Yes, but in this case i'm still using moo 1.1, so i dont know if that applies there. And when it comes to the garbage collection, i'm experiencing something strange, which i presume is garbage cleenup: I have mootools on top of google maps, where i update the data every 5 minutes. If you let the app run for +20 minutes, and try to close the window, you get a non responsive javascript window. As far as i can tell there is no extensive calculation on my end, so i'm presuming this is with the cleanup. Has anyone experienced this?
On Apr 2, 8:56 pm, nutron <[email protected]> wrote: > Using MooTools this is something you don't have to worry about so much these > days. It has its own garbage collection mechanisms. The important thing is > that you always use the MooTools methods for selecting elements: $, $$, > element.getElements, etc. But never document.getElementById, > document.getElementByClassName. If you use those methods, you must wrap > their results in $ and $$. > So long as your elements are collected through mootools (or passed through > $), they will be extended by MooTools and then garbage collected by > MooTools. > > On Thu, Apr 2, 2009 at 5:08 AM, electronbender (via Nabble) < > [email protected]<ml-user%[email protected]> > > > > > wrote: > > > I was just reading an article by Aaron about memory leaks, and > > although he does say what is bad he does not say what is good. > > So from the example this is bad: > > function sayHi(observeId, message) { > > var el = $(observeId); > > Event.observe(el, "click", function() { > > alert(message); > > }); > > } > > > But what is good? > > Is this: > > function sayHi(observeId, message) { > > Event.observe($(observeId), "click", function() { > > alert(message); > > }); > > } > > > Also, which of these 2 is good and which is bad: > > var someEl = new Element('div',{'id':'someEl'}) > > someEl.addEvent('click',function(){ > > alert('bla') > > }) > > someEl.injectInside($(somediv)) > > > Or this: > > var someEl = new Element('div',{'id':'someEl'}) > > someEl.injectInside($(somediv)) > > > $('someEl').addEvent('click',function(){ > > alert('bla') > > }) > > > ------------------------------ > > View message @ > >http://n2.nabble.com/-Moo--Memory-leaks-tp2574784p2574784.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.comwww.mootorial.com > Clientcide: http://www.clientcide.comwww.clientcide.com > -- > View this message in > context:http://n2.nabble.com/-Moo--Memory-leaks-tp2574784p2576981.html > Sent from the MooTools Users mailing list archive at Nabble.com.
