Skip to content

Instantly share code, notes, and snippets.

@icodeforlove
Created March 13, 2011 23:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save icodeforlove/868532 to your computer and use it in GitHub Desktop.
Save icodeforlove/868532 to your computer and use it in GitHub Desktop.
querySelectorAll for anything less than IE8
// IE7 support for querySelectorAll in 226 bytes... It's a little slow but better than a 20kb solution when you need something cross platform and lightweight.
(function(d){d=document,a=d.styleSheets[0]||d.createStyleSheet();d.querySelectorAll=function(e){a.addRule(e,'f:b');for(var l=d.all,b=0,c=[],f=l.length;b<f;b++)l[b].currentStyle.f&&c.push(l[b]);a.removeRule(0);return c}})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment