Nothing Special   »   [go: up one dir, main page]

r107534 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107533‎ | r107534 | r107535 >
Date:22:20, 28 December 2011
Author:krinkle
Status:ok
Tags:
Comment:
Move embedded ResourceLoader modules to the <head>
* Embed "private" ResourceLoader modules in the <head> before the first loader link, instead of in the <body> after the last loader link
* Wow, was in the opposite place where it should've been :D
* Fixes bug 30914
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoader.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -2575,7 +2575,9 @@
25762576 continue;
25772577 }
25782578
2579 - // Support inlining of private modules if configured as such
 2579+ // Support inlining of private modules if configured as such. Note that these
 2580+ // modules should be loaded from getHeadScripts() before the first loader call.
 2581+ // Otherwise other modules can't properly use them as dependencies (bug 30914)
25802582 if ( $group === 'private' && $wgResourceLoaderInlinePrivateModules ) {
25812583 if ( $ ResourceLoaderModule::TYPE_STYLES ) {
25822584 $links .= Html::inlineStyle(
@@ -2661,6 +2663,10 @@
26622664 )
26632665 );
26642666
 2667+ // Load embeddable private modules before any loader links
 2668+ $embedScripts = array( 'user.options', 'user.tokens' );
 2669+ $scripts .= $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
 2670+
26652671 // Script and Messages "only" requests marked for top inclusion
26662672 // Messages should go first
26672673 $scripts .= $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'top' ), ResourceLoaderModule::TYPE_MESSAGES );
@@ -2708,7 +2714,7 @@
27092715 // Legacy Scripts
27102716 $scripts .= "\n" . $this->mScripts;
27112717
2712 - $userScripts = array( 'user.options', 'user.tokens' );
 2718+ $userScripts = array();
27132719
27142720 // Add site JS if enabled
27152721 if ( $wgUseSiteJs ) {
Index: trunk/phase3/includes/resourceloader/ResourceLoader.php
@@ -913,8 +913,7 @@
914914 * @return string
915915 */
916916 public static function makeLoaderConditionalScript( $script ) {
917 - $script = str_replace( "\n", "\n\t", trim( $script ) );
918 - return "if(window.mw){\n\t$script\n}\n";
 917+ return "if(window.mw){\n".trim( $script )."\n}";
919918 }
920919
921920 /**
Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -197,6 +197,8 @@
198198 * (bug 30711) When adding a new section to a page with section=new, the text is
199199 now always added to the current version of the page
200200 * (bug 31719) Recognize &ns_svg; as the svg namespace when extracting width
 201+* (bug 30914) Embeddable ResourceLoader modules (user.options, user.tokens)
 202+ should be loaded in <head> for proper dependency resolution
201203
202204 === API changes in 1.19 ===
203205 * (bug 19838) siprop=interwikimap can now use the interwiki cache.

Follow-up revisions

RevisionCommit summaryAuthorDate
r111023(bug 34289) user.options CSS loaded twice. Caused by r107534. Made embedded p...catrope10:36, 9 February 2012

Status & tagging log