From: Roan Kattouw Date: Fri, 6 Jan 2012 15:06:39 +0000 (+0000) Subject: Followup r108184: fix loading in Opera. Before, Opera would only begin to render... X-Git-Tag: 1.31.0-rc.0~25480 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=f780dade7265dc7d6592bae7ffc20249c06f7e62;p=lhc%2Fweb%2Fwiklou.git Followup r108184: fix loading in Opera. Before, Opera would only begin to render the document after all async scripts were loaded, now it's the other way around (scripts load after the document is ready). This is not an improvement compared to the current situation, but it's not a regression either. --- diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index e390069f09..35ae8fc488 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -631,11 +631,20 @@ var mw = ( function ( $, undefined ) { } }; } - // IE-safe way of getting the . document.documentElement.head doesn't - // work in scripts that run in the - head = document.getElementsByTagName( 'head' )[0]; - // Append to the if available, to the otherwise - (document.body || head).appendChild( script ); + + if ( window.opera ) { + // Appending to the blocks rendering completely in Opera, + // so append to the after document ready. This means the + // scripts only start loading after the document has been rendered, + // but so be it. Opera users don't deserve faster web pages if their + // browser makes it impossible + $( function() { document.body.appendChild( script ); } ); + } else { + // IE-safe way of getting the . document.documentElement.head doesn't + // work in scripts that run in the + head = document.getElementsByTagName( 'head' )[0]; + ( document.body || head ).appendChild( script ); + } } else { document.write( mw.html.element( 'script', { 'type': 'text/javascript', 'src': src }, ''