Created
September 28, 2013 12:26
-
-
Save xyqfer/6741574 to your computer and use it in GitHub Desktop.
For Memory Leaks (IE6 and IE7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* http://javascript.crockford.com/memory/leak.html */ | |
function purge(d) { | |
var a = d.attributes, i, l, n; | |
if (a) { | |
for (i = a.length - 1; i >= 0; i -= 1) { | |
n = a[i].name; | |
if (typeof d[n] === 'function') { | |
d[n] = null; | |
} | |
} | |
} | |
a = d.childNodes; | |
if (a) { | |
l = a.length; | |
for (i = 0; i < l; i += 1) { | |
purge(d.childNodes[i]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment