On 12/14/06, heidmotron <[EMAIL PROTECTED]> wrote:
>
> maybe using the anonymous function was a bad example.
>
> my point is just the Event.observers array. it can get quite big if you
> have a ton of observers.
> let say you have a hundred elements each in a partial and each element
> has an observer for mouseover, mouseout and click
> a total of 300 observers
>
> if i re-render that partial
> instead of three hundred, I now have 600 because it doesn't clear the
> old elements from the array.
> and if the user lets say re-renders the partial 20 times I now have
> 6000 objects in array.

Yes it probably should for safe measure as pages live longer and
longer all the time.

I borrowed the Yahoo! UI YAHOO.util.Event.purgeElement() function and
blended it with the Prototype DOM manipulation functions to update,
replace, remove some HTML. Have a look at the remove function at the
bottom of this page...

<URL: 
http://dev.forkjavascript.org/trac/browser/trunk/public/javascripts/fork/mutate.js>

and the purgeElement function here

<URL: 
http://dev.forkjavascript.org/trac/browser/trunk/public/javascripts/fork/event.js>

Peter
-------
http://forkjavascript.org

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to