diff --git a/event/event.js b/event/event.js index 70111c61..5511b351 100644 --- a/event/event.js +++ b/event/event.js @@ -41,8 +41,12 @@ $.fn.hover = function(f,g) { }); }; +$.$$isReady = false; +$.$$ready = []; + // Handle when the DOM is ready -$.ready = function(isFinal) { +$.ready = function() { + $.$$isReady = true; if ( $.$$ready ) { for ( var i = 0; i < $.$$ready.length; i++ ) { $.apply( document, $.$$ready[i] ); @@ -51,27 +55,28 @@ $.ready = function(isFinal) { } }; -// Based off of: -// http://linguiste.org/projects/behaviour-DOMContentLoaded/example.html - // If Mozilla is used if ( $.browser == "mozilla" ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", $.ready, null ); -// If IE is used +// If IE is used, use the excellent hack by Matthias Miller +// http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited } else if ( $.browser == "msie" ) { + + // Only works if you document.write() it + document.write('