API: Fix fetching login token from action=query&meta=tokens on private wikis
[lhc/web/wiklou.git] / resources / src / mediawiki.special.apisandbox / apisandbox.js
index 631a5c6..c2c5960 100644 (file)
                                // Can't, sorry.
                        },
                        apiCheckValid: function () {
-                               var ok = this.getValue() !== null || suppressErrors;
-                               this.setIcon( ok ? null : 'alert' );
+                               var ok = this.getValue() !== null && this.getValue() !== undefined || suppressErrors;
+                               this.info.setIcon( ok ? null : 'alert' );
                                this.setTitle( ok ? '' : mw.message( 'apisandbox-alert-field' ).plain() );
                                return $.Deferred().resolve( ok ).promise();
                        }
        };
 
        /**
-       * Interface to ApiSandbox UI
-       *
-       * @class mw.special.ApiSandbox
-       */
+        * Interface to ApiSandbox UI
+        *
+        * @class mw.special.ApiSandbox
+        */
        ApiSandbox = {
                /**
                 * Initialize the UI