Safari 2 was having problems with the syntax used for the ready handling.

This commit is contained in:
John Resig 2007-10-01 14:14:09 +00:00
parent 1344a7fd50
commit beebbf8ba4

View file

@ -429,9 +429,9 @@ function bindReady(){
document.addEventListener( "DOMContentLoaded", jQuery.ready, false ); document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
// If Safari or IE is used // If Safari or IE is used
else else {
// Continually check to see if the document is ready // Continually check to see if the document is ready
(function timer() { function timer(){
try { try {
// If IE is used, use the trick by Diego Perini // If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/ // http://javascript.nwbox.com/IEContentLoaded/
@ -443,7 +443,10 @@ function bindReady(){
} catch( error ) { } catch( error ) {
setTimeout( timer, 0 ); setTimeout( timer, 0 );
} }
})(); }
timer();
}
// A fallback to window.onload, that will always work // A fallback to window.onload, that will always work
jQuery.event.add( window, "load", jQuery.ready ); jQuery.event.add( window, "load", jQuery.ready );