Create a gist now

Instantly share code, notes, and snippets.

* modified from
* only improve slightly to get small
var ie = function(v, p, needle, undef) {
needle = p.getElementsByTagName('br');
p.innerHTML = '<!--[if gt IE ' + (++v) + ']><br><![endif]-->',
return v > 4 ? v : undef;
}(3, document.createElement('p'));

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


@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