Recently I inherited a project from my senior colleagues that focused on seamless page reloading using AJAX. The code is filled with numerous functions like this one:
function iCreateProblems()
{
//some random code
document.getElementById('some_rubbish').innerHTML=obj1.responseText;
}
One common response text looks like this:
"<div onClick="handleMe()">something trivial</div>"
. This results in constant reloading of three main div elements on the page, potentially leading to memory leaks. With around 8000 lines of similar code, how can I address this issue and prevent further memory leaks? What should be my next steps when there are hundreds of handlers set up in this manner?