Yes, the handler will remain in memory. You'll want to call
stopObserving() before calling remove(). As of 1.6.0, you can call
stopObserving() with just the element (no event name or handler), and
Prototype will remove ALL handlers that were set up with observe()
from the element.

T.J. Crowder
tj / crowdersoftware / com

On Sep 20, 9:48 am, "Mert Hurturk" <[EMAIL PROTECTED]> wrote:
> Hi all,
> I have a question about event observing and memory management.
> -/ Let's say I have a div element on page. On dom load, my app starts to
> observe click event on this element: $('demo-div').observe('click',
> function() { alert('clicked')} );
> -/ Soon after, I remove this div from dom: $('demo-div').remove();
> What happens to event handler? Does it still use a segment of memory even
> the element it is assoicated is removed from dom? Maybe this is not an issue
> with a few elements but with large number of elements in a page, it will be
> a problem.
> Thanks,
> Mert H.
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to