From f780dade7265dc7d6592bae7ffc20249c06f7e62 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 6 Jan 2012 15:06:39 +0000 Subject: [PATCH] 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. --- resources/mediawiki/mediawiki.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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 }, '' -- 2.20.1