Created
May 18, 2010 19:22
-
-
Save jethrolarson/405414 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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