Use $.noop instead of function () {}
authorFomafix <fomafix@googlemail.com>
Fri, 23 Jun 2017 06:45:29 +0000 (08:45 +0200)
committerFomafix <fomafix@googlemail.com>
Fri, 23 Jun 2017 06:53:53 +0000 (08:53 +0200)
$.noop (https://api.jquery.com/jQuery.noop/) already provides an empty
function.

Change-Id: I7f1ca20a894d0469cb7bcb72c81722070e040956

resources/src/mediawiki.special/mediawiki.special.apisandbox.js

index 73c3c45..694f86a 100644 (file)
                                                if ( $.isFunction( f.focus ) ) {
                                                        f.focus();
                                                }
-                                       },
-                                       doNothing = function () {};
+                                       };
 
                                // This is something of a hack. We always want the 'format' and
                                // 'action' parameters from the main module to be specified,
                                                // it makes it too hard to read and our "disabled"
                                                // isn't really disabled.
                                                widgetField.onFieldDisable( false );
-                                               widgetField.onFieldDisable = doNothing;
+                                               widgetField.onFieldDisable = $.noop;
 
                                                if ( Util.apiBool( pi.parameters[ i ].deprecated ) ) {
                                                        deprecatedItems.push( widgetField, helpField );