My initial research has come up empty and I am not sure if this is possible. I am looking for a solution using straight up javascript. I cannot use jQuery due to constraints of the device. Basically, I want to attach an event for when an element is removed and provide a function to execute.
[EDIT]
We do the DOM manipulation via a function call. Right now, we currently don’t traverse down the whole tree to remove every single element. We only remove the parent for instance. I was hoping to provide a shortcut by attaching to an event, but I guess I will have to go the long way around and provide the additional logic in the function. The reason I need this, is because we need to be able to run cleanup operations on the DOM when specific elements are removed.
Right now the priority is only Opera support, but I would like to accomplish a cross browser solution.
If you’re interested in cross-browser support, “on element removal” isn’t an HTML 4 event, so I think you might be out of luck here. However, I think you’d have some luck if you adopted an alternate strategy: since you’re doing the removing, constrain the ways in which the element can be removed. Then simply invoke the callback there instead of in an event handler.