-
-
Save joacim-boive/943793 to your computer and use it in GitHub Desktop.
querySelectorAll for anything less than IE8
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
// 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
Script looks very promising, but I can't seem to get it to work :(
Running it out of the box in IE7 throws
Running the script through http://JSHint.com also threw errors, but I'm too green to know if that matters.