* (bug 30711) When adding a new section to a page with section=new, the text is
now always added to the current version of the page
* (bug 31719) Recognize &ns_svg; as the svg namespace when extracting width
+* (bug 30914) Embeddable ResourceLoader modules (user.options, user.tokens)
+ should be loaded in <head> for proper dependency resolution
=== API changes in 1.19 ===
* (bug 19838) siprop=interwikimap can now use the interwiki cache.
continue;
}
- // Support inlining of private modules if configured as such
+ // Support inlining of private modules if configured as such. Note that these
+ // modules should be loaded from getHeadScripts() before the first loader call.
+ // Otherwise other modules can't properly use them as dependencies (bug 30914)
if ( $group === 'private' && $wgResourceLoaderInlinePrivateModules ) {
if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
$links .= Html::inlineStyle(
)
);
+ // Load embeddable private modules before any loader links
+ $embedScripts = array( 'user.options', 'user.tokens' );
+ $scripts .= $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
+
// Script and Messages "only" requests marked for top inclusion
// Messages should go first
$scripts .= $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'top' ), ResourceLoaderModule::TYPE_MESSAGES );
// Legacy Scripts
$scripts .= "\n" . $this->mScripts;
- $userScripts = array( 'user.options', 'user.tokens' );
+ $userScripts = array();
// Add site JS if enabled
if ( $wgUseSiteJs ) {
* @return string
*/
public static function makeLoaderConditionalScript( $script ) {
- $script = str_replace( "\n", "\n\t", trim( $script ) );
- return "if(window.mw){\n\t$script\n}\n";
+ return "if(window.mw){\n".trim( $script )."\n}";
}
/**