Do any callbacks exists for when an element is removed from the DOM via
Element.remove()? Or maybe a custom event can be called just prior to the
removal? I need something like this to help me remove related "tooltip" divs
that are not direct descendants of the element being removed.
For example, I'd like to do something like this:

html:

<div id="foo">bar</div>
<div id="foo-tooltip">Tooltip!</div>

javascript:

document.observe('element:removed', function(event)
{
    var element = event.element(); // The element that fired the event
    var tooltip_id = element.identify() + '-tooltip';
    if $(tooltip_id) $(tooltip_id).remove();
});

$('foo').remove(); // fires 'element:removed', which removes associated
tooltip divs.


Would it be possible to do this by using Class.addMethods() to override the
behavior of Element.remove()? Thanks for the help!

-Hector

--~--~---------~--~----~------------~-------~--~----~
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 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to