Hi, There was a thread about that a while back, either here or over on the Core mailing list. The idea did have its proponents, but I think most of us felt that it was inappropriate overhead for the framework. Since the application knows whether it has hooked events on the element being removed or its descendants, the application should be responsible for cleaning those up. I don't want Prototype doing cleanup when I know that I've already done it as a natural part of my app logic.
If you want to do it, it's fairly straightforward: * * * * Element.addMethods({ // Remove all event handlers from the element and its descendants stopObservingDeep: function(element) { element = $(element); if (element) { element.stopObserving(); element.descendants().invoke('stopObserving'); } }, // Remove the element, unhooking all event handlers from it and its descendants first removeWithCleanup: function(element) { element = $(element); if (element) { element.stopObservingDeep(); element.remove(); } return element; } }); * * * * ...or something along those lines. I did two separate methods because "deeply" stopping observing is a logically distinct operation you may wish to use elsewhere (for instance, just before updating). FWIW, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Apr 9, 9:09 am, buda <www...@pochta.ru> wrote: > It's clear that Element.Remove should clean all event handlers and > storage for the removed element and its children or am I wrong? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---