Created
August 25, 2010 01:21
-
-
Save lifesinger/548648 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
/** | |
* modified from http://gist.github.com/527683 | |
* only improve slightly to get small | |
*/ | |
var ie = function(v, p, needle, undef) { | |
needle = p.getElementsByTagName('br'); | |
while( | |
p.innerHTML = '<!--[if gt IE ' + (++v) + ']><br><![endif]-->', | |
needle[0] | |
); | |
return v > 4 ? v : undef; | |
}(3, document.createElement('p')); |
@cowboy: needle is live nodelist, don't need to re get in loop
How did I not know that? That's really interesting, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(you'll need to test
p.getElementsByTagName('br')[0]
in the while loop)