Q:

Will this cause a browser memory leak?

I create a couple divs with an onclick event on them as children of 'parentDiv'. In the future, I set parentDiv.innerHTML = 'xyz' where xyz is more divs with onclick events, which replace the old ones. 
My question: will any browsers leak memory because I did not remove the onclick events of the the old div's before removing them from the dom?

A:

I would suggest reading up on memory leaks as explained by Douglas Crockford. The article gives you detailed examples of memory leaks and even a nice purge function allowing you to overcome the issues associated with them. Enjoy!

