Merge "mw.widgets.CategorySelector: Return {string}[] from getNewMenuItems' promise"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 11 Sep 2015 14:38:44 +0000 (14:38 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 11 Sep 2015 14:38:44 +0000 (14:38 +0000)
resources/src/mediawiki.widgets/mw.widgets.TitleInputWidget.js
resources/src/mediawiki/mediawiki.js

index 167b318..ee9583d 100644 (file)
                var widget = this;
 
                // Config initialization
-               config = $.extend( { maxLength: 255 }, config );
+               config = $.extend( {
+                       maxLength: 255,
+                       limit: 10
+               }, config );
 
                // Parent constructor
                mw.widgets.TitleInputWidget.parent.call( this, $.extend( {}, config, { autocomplete: false } ) );
@@ -38,7 +41,7 @@
                OO.ui.mixin.LookupElement.call( this, config );
 
                // Properties
-               this.limit = config.limit || 10;
+               this.limit = config.limit;
                this.maxLength = config.maxLength;
                this.namespace = config.namespace !== undefined ? config.namespace : null;
                this.relative = config.relative !== undefined ? config.relative : true;
index 5ba9781..c6e41c4 100644 (file)
                                // List of modules to be loaded
                                queue = [],
 
-                               // List of callback functions waiting for modules to be ready to be called
+                               /**
+                                * List of callback jobs waiting for modules to be ready.
+                                *
+                                * Jobs are created by #request() and run by #handlePending().
+                                *
+                                * Typically when a job is created for a module, the job's dependencies contain
+                                * both the module being requested and all its recursive dependencies.
+                                *
+                                * Format:
+                                *
+                                *     {
+                                *         'dependencies': [ module names ],
+                                *         'ready': Function callback
+                                *         'error': Function callback
+                                *     }
+                                *
+                                * @property {Object[]} jobs
+                                * @private
+                                */
                                jobs = [],
 
                                // Selector cache for the marker element. Use getMarker() to get/use the marker!
 
                                // Add ready and error callbacks if they were given
                                if ( ready !== undefined || error !== undefined ) {
-                                       jobs[ jobs.length ] = {
+                                       jobs.push( {
                                                dependencies: $.grep( dependencies, function ( module ) {
                                                        var state = mw.loader.getState( module );
                                                        return state === 'registered' || state === 'loaded' || state === 'loading';
                                                } ),
                                                ready: ready,
                                                error: error
-                                       };
+                                       } );
                                }
 
                                $.each( dependencies, function ( idx, module ) {