Created
February 27, 2010 18:23
-
-
Save antimatter15/316861 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
//Partial Implemenation CSS 2.1 Selectors in 500 bytes | |
function QSA(s){var p=[document.documentElement];(" "+s).replace(/ *([\>\+]) */g,"$1;%").replace(/ ([\.\#\:])/g," *$1").replace(/([ \%\.\#\:\>\+\[]|^)(;\% .+?\]|;|[^\[\.\#\:\>\+\% ]*)/g,function(z,o,a){for(var i=0,n=[],c;i<p.length;i++){c=p[i];c.nodeType==1&&(n=n.concat([].slice.call(eval({" ":'c.getElementsByTagName(a||"*")',">":"c.childNodes","+":"c.nextSibling","%":"c.tagName&&c.tagName.toLowerCase()==a.toLowerCase()?[c]:[]",".":'(" "+c.className+" ").indexOf(" "+a+" ")<0?[]:[c]',"#":"c.id==a?[c]:[]"}[o]))))}p=n});return p}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment