Okay, the Mozilla fix from the old post wouldn't work in the current
code, sorry for that.
Here is the actual code that will work in the current version of jQuery:
// Handle when the DOM is ready
ready: function() {
if (jQuery.browser.msie && document.readyState != "complete") return;
if( jQuery.browser.mozilla || jQuery.browser.opera ) {
document.removeEventListener( "DOMContentLoaded", $.ready, null
);
} else if ( jQuery.browser.msie ) {
document.detachEvent("onreadystatechange", $.ready);
}
// Make sure that the DOM is not already loaded
if ( !jQuery.isReady ) {
// Remember that the DOM is ready
jQuery.isReady = true;
// If there are functions bound, to execute
if ( jQuery.readyList ) {
// Execute all of them
for ( var i = 0; i < jQuery.readyList.length; i++ )
jQuery.readyList[i].apply( document );
// Reset the list of functions
jQuery.readyList = null;
}
}
}
...
// If Mozilla is used
if ( jQuery.browser.mozilla || jQuery.browser.opera ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
// if IE is used
} else if ( jQuery.browser.msie ) {
// Use another handy (but IE only) event callback
document.attachEvent( "onreadystatechange", jQuery.ready);
// If Safari is used
} else if ( jQuery.browser.safari ) {
...
And yes, this code does work. :)
Adam
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/