Synced with Sizzle codebase (which removed the use of the caching code).
This commit is contained in:
parent
77477d5634
commit
47aed822a4
|
@ -7,17 +7,8 @@
|
||||||
|
|
||||||
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]+\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g;
|
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]+\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g;
|
||||||
|
|
||||||
var cache = null;
|
|
||||||
var done = 0;
|
var done = 0;
|
||||||
|
|
||||||
if ( document.addEventListener && !document.querySelectorAll ) {
|
|
||||||
cache = {};
|
|
||||||
var invalidate = function(){ cache = {}; };
|
|
||||||
document.addEventListener("DOMAttrModified", invalidate, false);
|
|
||||||
document.addEventListener("DOMNodeInserted", invalidate, false);
|
|
||||||
document.addEventListener("DOMNodeRemoved", invalidate, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
var Sizzle = function(selector, context, results, seed) {
|
var Sizzle = function(selector, context, results, seed) {
|
||||||
var doCache = !results;
|
var doCache = !results;
|
||||||
results = results || [];
|
results = results || [];
|
||||||
|
@ -30,11 +21,6 @@ var Sizzle = function(selector, context, results, seed) {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cache && context === document && cache[ selector ] ) {
|
|
||||||
results.push.apply( results, cache[ selector ] );
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
var parts = [], m, set, checkSet, check, mode, extra;
|
var parts = [], m, set, checkSet, check, mode, extra;
|
||||||
|
|
||||||
// Reset the position of the chunker regexp (start from head)
|
// Reset the position of the chunker regexp (start from head)
|
||||||
|
@ -136,10 +122,6 @@ var Sizzle = function(selector, context, results, seed) {
|
||||||
Sizzle( extra, context, results );
|
Sizzle( extra, context, results );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cache && doCache ) {
|
|
||||||
cache[selector] = results.slice(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue