Is there a reason why Diego Perini's DOMContentLoaded IE trick is only implemented when the window is not in an iframe in popular JS libraries?
jQuery:
//If IE and not a frame continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
if ( document.documentElement.doScroll && toplevel ) {
doScrollCheck();
}
Prototype:
document.observe('readystatechange', checkReadyState);
if (window == top)
timer = pollDoScroll.defer();
Both of them are a window equal to the top, and if used to check the status of readiness document.documentElement.doScroll('left');. But why not use it when window != top?
source
share