Bug Tracker

Ticket #1319: 1319.diff

File 1319.diff, 1.5 kB (added by davidserduke, 9 months ago)

patch

  • src/event.js

     
    496496     
    497497    // If Safari or IE is used 
    498498    // Continually check to see if the document is ready 
    499     if (jQuery.browser.msie || jQuery.browser.safari ) (function(){ 
     499    if ( jQuery.browser.msie ) (function(){ 
    500500        try { 
    501501            // If IE is used, use the trick by Diego Perini 
    502502            // http://javascript.nwbox.com/IEContentLoaded/ 
    503             if ( jQuery.browser.msie || document.readyState != "loaded" && document.readyState != "complete" ) 
    504                 document.documentElement.doScroll("left"); 
     503            document.documentElement.doScroll("left"); 
    505504        } catch( error ) { 
    506             return setTimeout( arguments.callee, 0 ); 
     505            setTimeout( arguments.callee, 0 ); 
     506            return; 
    507507        } 
    508  
    509508        // and execute any waiting functions 
    510509        jQuery.ready(); 
    511510    })(); 
    512511 
     512    if ( jQuery.browser.safari ) { 
     513        var numStyles; 
     514        (function(){ 
     515             if ( document.readyState != "loaded" && document.readyState != "complete" ) { 
     516                setTimeout( arguments.callee, 0 ); 
     517                return; 
     518            } 
     519            if ( numStyles === undefined ) 
     520                numStyles = jQuery("style, link[rel=stylesheet]").length; 
     521            if ( document.styleSheets.length != numStyles ) { 
     522                setTimeout( arguments.callee, 0 ); 
     523                return; 
     524            } 
     525 
     526            // and execute any waiting functions 
     527            jQuery.ready(); 
     528        })(); 
     529    } 
     530 
    513531    // A fallback to window.onload, that will always work 
    514532    jQuery.event.add( window, "load", jQuery.ready ); 
    515533}