From: Timo Tijhof Date: Tue, 14 May 2013 20:58:18 +0000 (+0200) Subject: OutputPage: Guard jQuery.ready() against absence of jQuery X-Git-Tag: 1.31.0-rc.0~19679 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=1bd0d43f7fb6c61140caf9ecae3d059a3b8bfdd4;p=lhc%2Fweb%2Fwiklou.git OutputPage: Guard jQuery.ready() against absence of jQuery We already wrap usage of global "mediaWiki" in a condition for window.mw (see method ResourceLoader::makeLoaderConditionalScript) because: 1) The startup module blacklists certain browsers in which we won't load jquery+mediawiki. 2) It might have failed to load (for whatever reason). Adding guard for window.jQuery for the same reasons. Follows-up Ic3d0c937268d09, which caused a TypeError 'ready of undefined not a function' in browsers where jquery+mediawiki isn't loaded by the startup module. Change-Id: I9dcd8d347c6b00efe207d031a480e5b85bf78936 --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index bb4604fadd..2c9a081a25 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2967,7 +2967,7 @@ $templates // This also enforces $.isReady to be true at which fixes the // mw.loader bug in Firefox with using document.write between // and the DOMContentReady event (bug 47457). - $html = Html::inlineScript( 'jQuery.ready();' ); + $html = Html::inlineScript( 'window.jQuery && jQuery.ready();' ); if ( !$wgResourceLoaderExperimentalAsyncLoading ) { $html .= $this->getScriptsForBottomQueue( false );