Skip to content

Instantly share code, notes, and snippets.

@jethrolarson
Created May 18, 2010 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jethrolarson/405414 to your computer and use it in GitHub Desktop.
Save jethrolarson/405414 to your computer and use it in GitHub Desktop.
$.c = function(className){
return typeof document.getElementsByClassName === "function"
? $(document.getElementsByClassName(className)) : $('.'+className);
};
//In some brief tests I saw greater than 50% increase in speed for classNames.
$.q = function(sel){
return typeof document.querySelectorAll === "function"
? $(document.querySelectorAll(sel)) : $(sel);
};
//Much slower in the tests I've run...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment