It should not flow. One browser that infamously infiltrates like hell when the event handler calls the host object <> loop of the JS object is IE (prior to version 7), and IE (prior to version 8) does not support addEventListener .
Leave this in working order and see how the use of browser memory in the long run affects if you want to test it in a specific browser.
<div id="x"></div> <script type="text/javascript"> function replace() { var x= document.getElementById('x'); if (x.firstChild!==null) x.removeChild(x.firstChild); var el= document.createElement('p'); el.addEventListener('click', click, false); x.appendChild(el); } function click() { alert('click'); }; setInterval(replace, 1); </script>
(To test it with the reference loop, move the function click definition to the replace body.)
bobince
source share