Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.onload = function()
- {
- var
- body = document.getElementsByTagName('body')[0],
- div = document.createElement('div'),
- parentDiv, childDiv;
- for ( i = 0; i < 5000; i++ )
- {
- parentDiv = div.cloneNode(true);
- parentDiv.onclick = foo;
- childDiv = div.cloneNode(true);
- childDiv.onclick = bar;
- // Doesn't Leak
- body.appendChild(parentDiv);
- parentDiv.appendChild(childDiv);
- body.removeChild(parentDiv);
- parentDiv.removeChild(childDiv);
- parentDiv = null;
- childDiv = null;
- }
- body = null;
- }
Add Comment
Please, Sign In to add comment