Create a gist now

Instantly share code, notes, and snippets.

Embed
/**
* 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

This comment has been minimized.

Show comment
Hide comment
@cowboy

cowboy Aug 25, 2010

(you'll need to test p.getElementsByTagName('br')[0] in the while loop)

cowboy commented Aug 25, 2010

(you'll need to test p.getElementsByTagName('br')[0] in the while loop)

@lifesinger

This comment has been minimized.

Show comment
Hide comment
@lifesinger

lifesinger Aug 25, 2010

@cowboy: needle is live nodelist, don't need to re get in loop

Owner

lifesinger commented Aug 25, 2010

@cowboy: needle is live nodelist, don't need to re get in loop

@cowboy

This comment has been minimized.

Show comment
Hide comment
@cowboy

cowboy Aug 25, 2010

How did I not know that? That's really interesting, thanks!

cowboy commented Aug 25, 2010

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