Hi,

On Jun 16, 9:11 am, Acu <woj...@studioatrium.pl> wrote:
> I am curious what happens with references to Events registered through
> Event.Observe when object bound with those evenst is removed with
> Element.remove function. Are they automatically freed (like with
> Event.unloadCache)? Or maybe one should unregister those events with
> Event.stopObserving before removing object?

Prototype doesn't do anything to remove the handlers on `remove`,
they'll stay in memory.

If you know you've only set handlers on that element and none of its
children, yes, use `stopObserving`:

    $("theElement").stopObserving().remove();

If there may be handlers on the element's children as well, use
`purge`[1]:

    $("theElement").purge().remove();

It's not clear from the documentation, but `purge` does remove
handlers from the element's descendants.

[1] http://api.prototypejs.org/dom/Element/purge/

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

-- 
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 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to