Use Html::linkedScript()
authorAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 24 Jan 2010 19:43:02 +0000 (19:43 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 24 Jan 2010 19:43:02 +0000 (19:43 +0000)
Follow-up to r61432.  This has a simpler call interface and encapsulates
ugly $wgJsMimeType nonsense.

includes/OutputPage.php

index 26e1d60..020709e 100644 (file)
@@ -122,20 +122,13 @@ class OutputPage {
         * @param string $file filename in skins/common or complete on-server path (/foo/bar.js)
         */
        function addScriptFile( $file ) {
-               global $wgStylePath, $wgStyleVersion, $wgJsMimeType;
+               global $wgStylePath, $wgStyleVersion;
                if( substr( $file, 0, 1 ) == '/' ) {
                        $path = $file;
                } else {
                        $path =  "{$wgStylePath}/common/{$file}";
                }
-               $this->addScript( 
-                       Html::element( 'script', 
-                               array(
-                                       'type' => $wgJsMimeType,
-                                       'src' => "$path?$wgStyleVersion",
-                               )
-                       )
-               );
+               $this->addScript( Html::linkedScript( "$path?$wgStyleVersion" ) );
        }
 
        /**