DOMContentLoaded works in Opera 9b2+, so I have it firing for that now too - the means that there is a DOM Ready solution for every major browser! (Older version of Opera simply fallback to window.onload)

This commit is contained in:
John Resig 2006-06-16 04:23:30 +00:00
parent 66bd98be22
commit 9b7bbc619b

View file

@ -56,7 +56,7 @@ $.ready = function() {
};
// If Mozilla is used
if ( $.browser == "mozilla" ) {
if ( $.browser == "mozilla" || $.browser == "opera" ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", $.ready, null );
@ -79,8 +79,8 @@ if ( $.browser == "mozilla" ) {
// Clear from memory
script = null;
// If Safari or Opera is used
} else {
// If Safari is used
} else if ( $.browser == "safari" ) {
$.$$timer = setInterval(function(){
if ( document.readyState == "loaded" ||
document.readyState == "complete" ) {