Created
February 24, 2011 08:46
-
-
Save ded/841930 to your computer and use it in GitHub Desktop.
Smallest x-browser DOM Ready, ever
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
function r(f){/in/(document.readyState)?setTimeout(r,9,f):f()} |
So far this is the most stable solution I have seen, I tried @dperini but does not appear to work if DOMContentLoaded is already called, by say, jQuery, then it won't work. This small piece of code in the other hand, even though I was concerned by the looping timer, seems to work fine, and doesn't seem to even show up in js profiler, so i think i am liking it. I also like the size.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @mjschutz, your version works fine (at least on Chrome).