Here is a snippet of code from a jQuery source (bit.ly/jqsource):
// The DOM ready check for Internet Explorer function doScrollCheck() { if ( jQuery.isReady ) { return; } try { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); } catch(e) { setTimeout( doScrollCheck, 1 ); return; } // and execute any waiting functions jQuery.ready(); }
This is a hack when the DOM is ready for IE. Although it seems very beautiful in setTimeout( doScrollCheck, 1 ); bothers me a bit setTimeout( doScrollCheck, 1 ); , which means that the doScrollCheck() function is called 1000 times per second until the DOM is ready.
Should I expect this to be a huge performance leak?
source share