Guest User

Untitled

a guest
May 16th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. window.onload = function()
  2. {
  3. var
  4. body = document.getElementsByTagName('body')[0],
  5. div = document.createElement('div'),
  6. parentDiv, childDiv;
  7. for ( i = 0; i < 5000; i++ )
  8. {
  9. parentDiv = div.cloneNode(true);
  10. parentDiv.onclick = foo;
  11. childDiv = div.cloneNode(true);
  12. childDiv.onclick = bar;
  13.  
  14. // Doesn't Leak
  15. body.appendChild(parentDiv);
  16. parentDiv.appendChild(childDiv);
  17. body.removeChild(parentDiv);
  18. parentDiv.removeChild(childDiv);
  19. parentDiv = null;
  20. childDiv = null;
  21. }
  22. body = null;
  23. }
Add Comment
Please, Sign In to add comment