* Also fixed IE bug, where "delete window.myThing;" fails but "delete myThing;" succeeds.
// Startup function
$configuration = FormatJson::encode( $this->getConfig( $context ) );
$registrations = self::getModuleRegistrations( $context );
- $out .= "window.startUp = function() {\n\t$registrations\n\tmediaWiki.config.set( $configuration );\n};";
+ $out .= "var startUp = function() {\n\t$registrations\n\tmediaWiki.config.set( $configuration );\n};";
// Conditional script injection
$scriptTag = Xml::escapeJsString( Html::linkedScript( $wgLoadScript . '?' . wfArrayToCGI( $query ) ) );
- $out .= "if ( isCompatible() ) {\n\tdocument.write( '$scriptTag' );\n}\ndelete window['isCompatible'];";
+ $out .= "if ( isCompatible() ) {\n\tdocument.write( '$scriptTag' );\n}\ndelete isCompatible;";
}
return $out;
} )( jQuery );
-
/* Auto-register from pre-loaded startup scripts */
-if ( typeof window['startUp'] === 'function' ) {
- window['startUp']();
- delete window['startUp'];
+if ( typeof startUp === 'function' ) {
+ startUp();
+ delete startUp;
}
\ No newline at end of file
* * Opera 9+
* * Chrome 1+
*/
-window.isCompatible = function() {
+var isCompatible = function() {
// IE < 6
if ( navigator.appVersion.indexOf( 'MSIE' ) !== -1 && parseFloat( navigator.appVersion.split( 'MSIE' )[1] ) < 6 ) {
return false;