The existing code of stopObserving doesn't cleanup CACHE variable which is used to cleanup all observers on page unload. Even if I detach all handlers from an element using stopObserving(), the CACHE variable will still have a reference to the element (and the whole tree).
The proposed patch fixes the problem.
Fix memory leak in stopObserving when it may keep a reference to watc…
…hed elements forever (until page reload)
Fix performance problem with stopObserving introduced by my previous …
…memory leak fix.
My original fix introduced a performance problem with stopObserving call. Now, this problem is fixed.
I just merged my rewrite of dom.js and event.js — it fixes this problem. Thanks!