Skip to content

Commit

Permalink
Synced with Sizzle codebase (which removed the use of the caching code).
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Dec 22, 2008
1 parent 77477d5 commit 47aed82
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/selector.js
Expand Up @@ -7,17 +7,8 @@

var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]+\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g;

var cache = null;
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 doCache = !results;
results = results || [];
Expand All @@ -30,11 +21,6 @@ var Sizzle = function(selector, context, results, seed) {
return results;
}

if ( cache && context === document && cache[ selector ] ) {
results.push.apply( results, cache[ selector ] );
return results;
}

var parts = [], m, set, checkSet, check, mode, extra;

// Reset the position of the chunker regexp (start from head)
Expand Down Expand Up @@ -136,10 +122,6 @@ var Sizzle = function(selector, context, results, seed) {
Sizzle( extra, context, results );
}

if ( cache && doCache ) {
cache[selector] = results.slice(0);
}

return results;
};

Expand Down

0 comments on commit 47aed82

Please sign in to comment.