Skip to content

Instantly share code, notes, and snippets.

@munky69rock
Created May 13, 2012 00:32
Show Gist options
  • Save munky69rock/2669913 to your computer and use it in GitHub Desktop.
Save munky69rock/2669913 to your computer and use it in GitHub Desktop.
jQuery selector cache
// ----
var $$$ = (function(){
var pool = {};
function $$$ (key) {
if (!pool[key]) {
pool[key] = $(key);
}
return pool[key];
}
$$$.clear = function () {
pool = {};
};
return $$$;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment