Follow-up r83280; looks like I accidentally deprecated a piece of legacy JS :D
authorHappy-melon <happy-melon@users.mediawiki.org>
Sat, 5 Mar 2011 17:06:42 +0000 (17:06 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Sat, 5 Mar 2011 17:06:42 +0000 (17:06 +0000)
includes/HTMLForm.php
resources/Resources.php
skins/common/htmlform.js [deleted file]

index 56577f6..5a0fbae 100644 (file)
@@ -54,7 +54,6 @@
  * TODO: Document 'section' / 'subsection' stuff
  */
 class HTMLForm {
-       static $jsAdded = false;
 
        # A mapping of 'type' inputs onto standard HTMLFormField subclasses
        static $typeMappings = array(
@@ -160,14 +159,9 @@ class HTMLForm {
        /**
         * Add the HTMLForm-specific JavaScript, if it hasn't been
         * done already.
+        * @deprecated @since 1.18 load modules with ResourceLoader instead
         */
-       static function addJS() {
-               if ( self::$jsAdded ) return;
-
-               global $wgOut;
-
-               $wgOut->addModules( 'mediawiki.legacy.htmlform' );
-       }
+       static function addJS() { }
 
        /**
         * Initialise a new Object for the field
@@ -202,9 +196,6 @@ class HTMLForm {
                        throw new MWException( "You must call setTitle() on an HTMLForm" );
                }
 
-               // FIXME shouldn't this be closer to displayForm() ?
-               self::addJS();
-
                # Load data from the request.
                $this->loadData();
        }
index 13065c8..7d4f50e 100644 (file)
@@ -544,12 +544,6 @@ return array(
                'localBasePath' => "{$GLOBALS['IP']}/skins",
                'dependencies' => 'mediawiki.legacy.wikibits',
        ),
-       'mediawiki.legacy.htmlform' => array(
-               'scripts' => 'common/htmlform.js',
-               'remoteBasePath' => $GLOBALS['wgStylePath'],
-               'localBasePath' => "{$GLOBALS['IP']}/skins",
-               'dependencies' => 'mediawiki.legacy.wikibits',
-       ),
        'mediawiki.legacy.IEFixes' => array(
                'scripts' => 'common/IEFixes.js',
                'remoteBasePath' => $GLOBALS['wgStylePath'],
@@ -581,7 +575,7 @@ return array(
                'scripts' => 'common/prefs.js',
                'remoteBasePath' => $GLOBALS['wgStylePath'],
                'localBasePath' => "{$GLOBALS['IP']}/skins",
-               'dependencies' => array( 'mediawiki.legacy.wikibits', 'mediawiki.legacy.htmlform' ),
+               'dependencies' => array( 'mediawiki.legacy.wikibits', 'mediawiki.htmlform' ),
        ),
        'mediawiki.legacy.preview' => array(
                'scripts' => 'common/preview.js',
diff --git a/skins/common/htmlform.js b/skins/common/htmlform.js
deleted file mode 100644 (file)
index 9e91017..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// Find select-or-other fields.
-addOnloadHook( function() {
-       var fields = getElementsByClassName( document, 'select', 'mw-htmlform-select-or-other' );
-
-       for( var i = 0; i < fields.length; i++ ) {
-               var select = fields[i];
-
-               addHandler( select, 'change', htmlforms.selectOrOtherSelectChanged );
-
-               // Use a fake 'e' to update it.
-               htmlforms.selectOrOtherSelectChanged( { 'target': select } );
-       }
-} );
-
-window.htmlforms = {
-       'selectOrOtherSelectChanged' : function( e ) {
-               var select;
-               if ( !e ) {
-                       e = window.event;
-               }
-               if ( e.target ) {
-                       select = e.target;
-               } else if ( e.srcElement ) {
-                       select = e.srcElement;
-               }
-               if ( select.nodeType == 3 ) { // defeat Safari bug
-                       select = select.parentNode;
-               }
-
-               var id = select.id;
-               var textbox = document.getElementById( id + '-other' );
-
-               textbox.disabled = ( select.value != 'other' );
-       }
-};
-