* @return string
*/
public static function makeLoaderConditionalScript( $script ) {
- return "var RLQ = RLQ || []; RLQ.push( function () {\n" . trim( $script ) . "\n} );";
+ return "window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n" . trim( $script ) . "\n} );";
}
/**
$js = self::makeLoaderConditionalScript( $script );
return new WrappedString(
Html::inlineScript( $js ),
- "<script>var RLQ = RLQ || []; RLQ.push( function () {\n",
+ "<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n",
"\n} );</script>"
);
}
// Load module script only
array(
array( 'test.foo', ResourceLoaderModule::TYPE_SCRIPTS ),
- "<script>var RLQ = RLQ || []; RLQ.push( function () {\n"
+ "<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
. 'mw.loader.load("http://127.0.0.1:8080/w/load.php?debug=false\u0026lang=en\u0026modules=test.foo\u0026only=scripts\u0026skin=fallback\u0026*");'
. "\n} );</script>"
),
// Load private module (only=scripts)
array(
array( 'test.quux', ResourceLoaderModule::TYPE_SCRIPTS ),
- "<script>var RLQ = RLQ || []; RLQ.push( function () {\n"
+ "<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
. "mw.test.baz({token:123});mw.loader.state({\"test.quux\":\"ready\"});\n"
. "\n} );</script>"
),
// Load private module (combined)
array(
array( 'test.quux', ResourceLoaderModule::TYPE_COMBINED ),
- "<script>var RLQ = RLQ || []; RLQ.push( function () {\n"
+ "<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
. "mw.loader.implement(\"test.quux\",function($,jQuery){"
. "mw.test.baz({token:123});},{\"css\":[\".mw-icon{transition:none}\\n"
. "\"]});\n\n} );</script>"
// Load two modules in separate groups
array(
array( array( 'test.group.foo', 'test.group.bar' ), ResourceLoaderModule::TYPE_COMBINED ),
- "<script>var RLQ = RLQ || []; RLQ.push( function () {\n"
+ "<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
. 'mw.loader.load("http://127.0.0.1:8080/w/load.php?debug=false\u0026lang=en\u0026modules=test.group.bar\u0026skin=fallback\u0026*");'
. "\n} );</script>\n"
- . "<script>var RLQ = RLQ || []; RLQ.push( function () {\n"
+ . "<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
. 'mw.loader.load("http://127.0.0.1:8080/w/load.php?debug=false\u0026lang=en\u0026modules=test.group.foo\u0026skin=fallback\u0026*");'
. "\n} );</script>"
),