i am using jquery and doing something like this
DOM:
DOM
Can't comment on the leakage problem but you could simply use .empty() instead of .html(''). That way you'd clean the innerHTML and remove any bound event handlers.
.empty()
.html('')