OutputPage: Tiny tweak to jQuery.ready inline script
authorOri Livneh <ori@wikimedia.org>
Wed, 1 Apr 2015 08:48:29 +0000 (01:48 -0700)
committerKrinkle <krinklemail@gmail.com>
Wed, 1 Apr 2015 17:03:54 +0000 (17:03 +0000)
Changing 'window.jQuery && jQuery.ready()' to 'if ( window.jQuery )
jQuery.ready()' means no *<![CDATA[*/ /*]]>* is required (because we
got rid of the ampersands). It's also more readable and more consistent
with if(window.mw).

Change-Id: I28262efb978c085e732b40f9dc5ddb1bda5c4376

includes/OutputPage.php

index edeae0d..1a4f5b7 100644 (file)
@@ -3106,7 +3106,7 @@ class OutputPage extends ContextSource {
                // This also enforces $.isReady to be true at </body> which fixes the
                // mw.loader bug in Firefox with using document.write between </body>
                // and the DOMContentReady event (bug 47457).
-               $html = Html::inlineScript( 'window.jQuery && jQuery.ready();' );
+               $html = Html::inlineScript( 'if(window.jQuery)jQuery.ready();' );
 
                if ( !$this->getConfig()->get( 'ResourceLoaderExperimentalAsyncLoading' ) ) {
                        $html .= $this->getScriptsForBottomQueue( false );