javascript 设计模式大神原创
http://dustindiaz.com/smallest-domready-ever
function r(f){/in/.test(document.readyState)?setTimeout('r('+f+')',9):f()}
我改造了一下
function ready(fn){var delay;/complete/.test(document.readyState)?delay=setTimeout(function(){arguments.callee.apply(null,arguments)},9):delay&& clearTimeout(delay),fn()}
请看测试结果