Anomie has submitted this change and it was merged.
Change subject: Call jQuery.ready() before </body>
......................................................................
Call jQuery.ready() before </body>
mw.loader defaults to async=false. Overridden when $.isReady=true
or a mw.loader call sets async=true.
The problem is in calls to mw.loader.load that are not in
the HTML output but occur *before* the DOMContentReady event.
In those cases we want to use async (creating a script tag)
instead of synchronous (document.write) because in Firefox
DOMContentReady is emitted some time after it is no longer safe
to use document.write (bug 47457).
This also optimises the dom ready event cross-browser.
Bug: 34542
Bug: 47457
Change-Id: Ic3d0c937268d0943d2f770f3ca18bcf4e1eed346
(cherry picked from commit 0a000d5cf4f915f8b5cdb5e2b25674200952f4ce)
---
M includes/OutputPage.php
1 file changed, 10 insertions(+), 3 deletions(-)
Approvals:
Anomie: Verified; Looks good to me, approved
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 9f911d5..9ec1fa1 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -2950,11 +2950,18 @@
*/
function getBottomScripts() {
global $wgResourceLoaderExperimentalAsyncLoading;
+
+ // Optimise jQuery ready event cross-browser.
+ // 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( 'jQuery.ready();' );
+
if ( !$wgResourceLoaderExperimentalAsyncLoading ) {
- return $this->getScriptsForBottomQueue( false );
- } else {
- return '';
+ $html .= $this->getScriptsForBottomQueue( false );
}
+
+ return $html;
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/61494
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic3d0c937268d0943d2f770f3ca18bcf4e1eed346
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.22wmf2
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits