fix memory leak in IE

This commit is contained in:
Brandon Aaron 2009-05-04 00:05:04 +00:00
parent c6b59263b5
commit d72b8307de

View file

@ -8,7 +8,8 @@
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
done = 0, done = 0,
toString = Object.prototype.toString; toString = Object.prototype.toString,
hasDuplicate = false;
var Sizzle = function(selector, context, results, seed) { var Sizzle = function(selector, context, results, seed) {
results = results || []; results = results || [];
@ -760,6 +761,7 @@ if ( document.documentElement.compareDocumentPosition ) {
} }
root.removeChild( form ); root.removeChild( form );
root = form = null; // release memory in IE
})(); })();
(function(){ (function(){
@ -800,6 +802,8 @@ if ( document.documentElement.compareDocumentPosition ) {
return elem.getAttribute("href", 2); return elem.getAttribute("href", 2);
}; };
} }
div = null; // release memory in IE
})(); })();
if ( document.querySelectorAll ) (function(){ if ( document.querySelectorAll ) (function(){
@ -829,6 +833,8 @@ if ( document.querySelectorAll ) (function(){
for ( var prop in oldSizzle ) { for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ]; Sizzle[ prop ] = oldSizzle[ prop ];
} }
div = null; // release memory in IE
})(); })();
if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
@ -851,6 +857,8 @@ if ( document.getElementsByClassName && document.documentElement.getElementsByCl
return context.getElementsByClassName(match[1]); return context.getElementsByClassName(match[1]);
} }
}; };
div = null; // release memory in IE
})(); })();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
@ -969,7 +977,7 @@ jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters; jQuery.expr[":"] = jQuery.expr.filters;
Sizzle.selectors.filters.hidden = function(elem){ Sizzle.selectors.filters.hidden = function(elem){
return elem.offsetWidth === 0 && elem.offsetHeight === 0; return elem.offsetWidth === 0 || elem.offsetHeight === 0;
}; };
Sizzle.selectors.filters.visible = function(elem){ Sizzle.selectors.filters.visible = function(elem){