IE DOMContentLoaded documentElement.doScroll
javascript, jquery, jquery-events
Solution
This bug report for YUI library states that doScroll in framed document doesn't work the same way as when run on top level (doesn't throw errors when document isn't ready).
Problem
Is there any reason why DOMContentLoaded trick for IE by Diego Perini is implemented only when window is not in 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 checks is window is equal to top and if it is the `document.documentElement.doScroll('left');` is used to check ready state. But why not to use it when `window != top`?