Make WordPress Core

Changeset 63456


Ignore:
Timestamp:
09/03/2026 11:26:20 PM (2 months ago)
Author:
westonruter
Message:

Customize: Correct the widgets and menus JSDoc.

Three blocks described something the code does not do.

  1. WidgetsPanel lent its prototype to WigetsPanel, so its methods were attached to a name that appears nowhere else in core.
  2. WidgetControl.onChangeExpanded() said its arguments were merged over defaultActiveArguments, while the handler that calls it merges over defaultExpandedArguments; the two carry separate defaults and separate queues, so the wrong one points a reader at the wrong callback.
  3. The field toggle handler in the menu section annotated this as a jQuery object, when it is used with each() and a click binding, both of which set this to the raw element its body then wraps.

The offset parameters described what they accept by writing out the two literals it may hold, which does not convey that the sign selects a direction rather than an amount.

Developed as subset of ​https://github.com/WordPress/wordpress-develop/pull/10743.
Follow-up to r48650, r63454, r63455.

Props westonruter, afercia.
See #39671, #40831, #64662, #66033.

Location:
trunk/src/js/_enqueues/wp/customize
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/customize/nav-menus.js

    r62431 r63456  
    44
    55/* global menus, _wpCustomizeNavMenusSettings, wpNavMenu, console */
     6
     7/**
     8 * @param {Object}       api The Customizer API.
     9 * @param {Object}       wp  The WordPress global object.
     10 * @param {JQueryStatic} $   The jQuery object.
     11 */
    612( function( api, wp, $ ) {
    713        'use strict';
    … …  
    4551         * @alias wp.customize.Menus.generatePlaceholderAutoIncrementId
    4652         *
    47          * @return {number}
     53         * @return {number} A negative integer ID.
    4854         */
    4955        api.Menus.generatePlaceholderAutoIncrementId = function() {
    … …  
    96102         * @alias wp.customize.Menus.insertAutoDraftPost
    97103         *
    98          * @param {Object} params - Parameters for the draft post to create.
    99          * @param {string} params.post_type - Post type to add.
    100          * @param {string} params.post_title - Post title to use.
    101          * @return {jQuery.promise} Promise resolved with the added post.
     104         * @param {Object} params           Parameters for the draft post to create.
     105         * @param {string} params.post_type Post type to add.
     106         * @param {string} params.post_title Post title to use.
     107         * @return {JQuery.Promise<*>} Promise resolved with the added post.
    102108         */
    103109        api.Menus.insertAutoDraftPost = function insertAutoDraftPost( params ) {
    … …  
    391397                 * @access private
    392398                 *
    393                  * @param {Array.<Object>} itemTypes List of objects containing type and key.
    394                  * @param {string} deprecated Formerly the object parameter.
     399                 * @param {Object[]} itemTypes List of objects containing type and key.
     400                 * @param {string}   deprecated Formerly the object parameter.
    395401                 * @return {void}
    396402                 */
    … …  
    631637                 * @private
    632638                 *
    633                  * @param {jQuery.Event} event Event.
     639                 * @param {JQuery.Event} event Event.
    634640                 * @return {void}
    635641                 */
    … …  
    657663                 * @private
    658664                 *
    659                  * @param {jQuery} container
     665                 * @param {JQuery} container The container of the form for creating the new item.
    660666                 * @return {void}
    661667                 */
    … …  
    920926                 * @private
    921927                 *
    922                  * @return {Array} Fields (columns) that are hidden.
     928                 * @return {string} Comma separated list of the fields (columns) that are hidden.
    923929                 */
    924930                hidden: function() {
    … …  
    946952                 * @since 4.3.0
    947953                 *
    948                  * @param {string} id
    949                  * @param {Object} options
     954                 * @param {string} id      The ID for the section.
     955                 * @param {Object} options Options.
    950956                 */
    951957                initialize: function( id, options ) {
    … …  
    10151021                         * Update the active field class for the content container for a given checkbox toggle.
    10161022                         *
    1017                          * @this {jQuery}
     1023                         * @this {HTMLInputElement}
    10181024                         * @return {void}
    10191025                         */
    … …  
    11421148
    11431149                /**
    1144                  * @param {Array} themeLocationSlugs Theme location slugs.
     1150                 * @param {string[]} themeLocationSlugs Theme location slugs.
    11451151                 */
    11461152                updateAssignedLocationsInSectionTitle: function( themeLocationSlugs ) {
    … …  
    13351341                         *
    13361342                         * @since 4.9.0
    1337                          * @param {wp.customize.Setting} setting - Added setting.
     1343                         * @param {wp.customize.Setting} setting Added setting.
    13381344                         * @return {void}
    13391345                         */
    … …  
    13491355                         *
    13501356                         * @since 4.9.0
    1351                          * @param {wp.customize.Setting} setting - Removed setting.
     1357                         * @param {wp.customize.Setting} setting Removed setting.
    13521358                         * @return {void}
    13531359                         */
    … …  
    13641370                        updateNoticeVisibility();
    13651371
    1366                         api.Section.prototype.attachEvents.apply( section, arguments );
     1372                        api.Section.prototype.attachEvents.call( section );
    13671373                },
    13681374
    … …  
    14841490                 * @since 4.9.0
    14851491                 *
    1486                  * @param {string|null} locationId - The ID of the location to select. `null` clears all selections.
     1492                 * @param {string|null} locationId The ID of the location to select. `null` clears all selections.
    14871493                 * @return {void}
    14881494                 */
    … …  
    16431649                 * Shows or hides buttons based on the location of the menu item.
    16441650                 *
    1645                  * @param {Object} itemToRefresh The menu item that might need its advanced accessibility buttons refreshed
    1646                  * 
     1651                 * @param {Object} itemToRefresh The menu item that might need its advanced accessibility buttons refreshed.
     1652                 *
    16471653                 * @since 6.6.0
    16481654                 */
    … …  
    17241730                        control.renderContent();
    17251731                        control.deferred.embedded.resolve(); // This triggers control.ready().
    1726                        
     1732
    17271733                        // Mark all menu items as unprocessed.
    17281734                        $( 'button.item-edit' ).data( 'needs_accessibility_refresh', true );
    … …  
    18031809                                        control.params.depth += 1;
    18041810                                }
    1805                                
     1811
    18061812                                moveBtn.focus(); // Re-focus after the container was moved.
    18071813
    … …  
    20372043
    20382044                /**
    2039                  *
    2040                  * @return {number}
     2045                 * Gets the depth of the menu item.
     2046                 *
     2047                 * @return {number} The depth of the menu item.
    20412048                 */
    20422049                getDepth: function() {
    … …  
    21042111
    21052112                /**
    2106                  * @return {wp.customize.controlConstructor.nav_menu|null}
     2113                 * Gets the menu control that this menu item belongs to.
     2114                 *
     2115                 * @return {wp.customize.Menus.MenuControl|null} The menu control, or null if not found.
    21072116                 */
    21082117                getMenuControl: function() {
    … …  
    21282137                 * @since 4.6.0
    21292138                 *
    2130                  * @param {Boolean} expanded
    2131                  * @param {Object} [params]
    2132                  * @return {Boolean} False if state already applied.
     2139                 * @param {boolean} expanded The new state to apply.
     2140                 * @param {Object}  [params] Object containing options for expand/collapse.
     2141                 * @return {boolean} False if state already applied.
    21332142                 */
    21342143                _toggleExpanded: api.Section.prototype._toggleExpanded,
    … …  
    21372146                 * @since 4.6.0
    21382147                 *
    2139                  * @param {Object} [params]
    2140                  * @return {Boolean} False if already expanded.
     2148                 * @param {Object} [params] Object containing options for expansion.
     2149                 * @return {boolean} False if already expanded.
    21412150                 */
    21422151                expand: api.Section.prototype.expand,
    … …  
    21472156                 * @since 4.5.0 Added params.completeCallback.
    21482157                 *
    2149                  * @param {Object}   [params] - Optional params.
    2150                  * @param {Function} [params.completeCallback] - Function to call when the form toggle has finished animating.
     2158                 * @param {Object}   [params]                 Optional params.
     2159                 * @param {Function} [params.completeCallback] Function to call when the form toggle has finished animating.
    21512160                 */
    21522161                expandForm: function( params ) {
    … …  
    21572166                 * @since 4.6.0
    21582167                 *
    2159                  * @param {Object} [params]
    2160                  * @return {Boolean} False if already collapsed.
     2168                 * @param {Object} [params] Object containing options for collapse.
     2169                 * @return {boolean} False if already collapsed.
    21612170                 */
    21622171                collapse: api.Section.prototype.collapse,
    … …  
    21672176                 * @since 4.5.0 Added params.completeCallback.
    21682177                 *
    2169                  * @param {Object}   [params] - Optional params.
    2170                  * @param {Function} [params.completeCallback] - Function to call when the form toggle has finished animating.
     2178                 * @param {Object}   [params]                 Optional params.
     2179                 * @param {Function} [params.completeCallback] Function to call when the form toggle has finished animating.
    21712180                 */
    21722181                collapseForm: function( params ) {
    … …  
    21802189                 * @since 4.5.0 Added params.completeCallback.
    21812190                 *
    2182                  * @param {boolean}  [showOrHide] - If not supplied, will be inverse of current visibility
    2183                  * @param {Object}   [params] - Optional params.
    2184                  * @param {Function} [params.completeCallback] - Function to call when the form toggle has finished animating.
     2191                 * @param {boolean}  [showOrHide]              If not supplied, will be inverse of current visibility.
     2192                 * @param {Object}   [params]                 Optional params.
     2193                 * @param {Function} [params.completeCallback] Function to call when the form toggle has finished animating.
    21852194                 */
    21862195                toggleForm: function( showOrHide, params ) {
    … …  
    21992208                 *
    22002209                 * @since 4.6.0
    2201                  * @param {boolean}  [showOrHide] - If not supplied, will be inverse of current visibility
    2202                  * @param {Object}   [params] - Optional params.
    2203                  * @param {Function} [params.completeCallback] - Function to call when the form toggle has finished animating.
     2210                 * @param {boolean}  [showOrHide]              If not supplied, will be inverse of current visibility.
     2211                 * @param {Object}   [params]                 Optional params.
     2212                 * @param {Function} [params.completeCallback] Function to call when the form toggle has finished animating.
    22042213                 */
    22052214                onChangeExpanded: function( showOrHide, params ) {
    … …  
    22682277                 * @since 4.5.0 Added params.completeCallback.
    22692278                 *
    2270                  * @param {Object}   [params] - Params object.
    2271                  * @param {Function} [params.completeCallback] - Optional callback function when focus has completed.
     2279                 * @param {Object}   [params]                 Params object.
     2280                 * @param {Function} [params.completeCallback] Optional callback function when focus has completed.
    22722281                 */
    22732282                focus: function( params ) {
    … …  
    23392348                 * @private
    23402349                 *
    2341                  * @param {number} offset 1|-1
     2350                 * @param {number} offset The number of positions to move the item, either 1 or -1.
    23422351                 */
    23432352                _changePosition: function( offset ) {
    … …  
    23992408                 * @private
    24002409                 *
    2401                  * @param {number} offset 1|-1
     2410                 * @param {number} offset The number of levels to change the depth by, either 1 or -1.
    24022411                 */
    24032412                _changeDepth: function( offset ) {
    … …  
    25952604                 * @since 4.9.0
    25962605                 *
    2597                  * @param {Object.<string,boolean>} selections - A map of location selections.
     2606                 * @param {Object.<string, boolean>} selections A map of location selections.
    25982607                 * @return {void}
    25992608                 */
    … …  
    27822791                 * which is called in MenuSection.onChangeExpanded()
    27832792                 *
    2784                  * @param {Object} menuList - The element that has sortable().
     2793                 * @param {Object} menuList The element that has sortable().
    27852794                 */
    27862795                _setupSortable: function( menuList ) {
    … …  
    29842993                 * Enable/disable the reordering UI
    29852994                 *
    2986                  * @param {boolean} showOrHide to enable/disable reordering
     2995                 * @param {boolean} showOrHide Whether to enable or disable reordering.
    29872996                 */
    29882997                toggleReordering: function( showOrHide ) {
    … …  
    30203029
    30213030                /**
    3022                  * @return {wp.customize.controlConstructor.nav_menu_item[]}
     3031                 * Get all of the nav_menu_item controls for this menu.
     3032                 *
     3033                 * @return {wp.customize.Menus.MenuItemControl[]} The nav_menu_item controls for this menu.
    30233034                 */
    30243035                getMenuItemControls: function() {
    … …  
    31173128                 * settings have been updated.
    31183129                 */
    3119                 debouncedReflowMenuItems: _.debounce( function() {
    3120                         this.reflowMenuItems.apply( this, arguments );
     3130                debouncedReflowMenuItems: _.debounce( function( ...args ) {
     3131                        this.reflowMenuItems.apply( this, args );
    31213132                }, 0 ),
    31223133
    … …  
    31243135                 * Add a new item to this menu.
    31253136                 *
    3126                  * @param {Object} item - Value for the nav_menu_item setting to be created.
    3127                  * @return {wp.customize.Menus.controlConstructor.nav_menu_item} The newly-created nav_menu_item control instance.
     3137                 * @param {Object} item Value for the nav_menu_item setting to be created.
     3138                 * @return {wp.customize.Menus.MenuItemControl} The newly-created nav_menu_item control instance.
    31283139                 */
    31293140                addItemToMenu: function( item ) {
    … …  
    31903201                 * @since 4.9.0
    31913202                 *
    3192                  * @param {wp.customize.controlConstructor.nav_menu_item[]} optionalMenuItemControls
     3203                 * @param {wp.customize.Menus.MenuItemControl[]} [optionalMenuItemControls] The menu item controls to
     3204                 *                                                                          consider. Defaults to all of
     3205                 *                                                                          this menu's item controls.
    31933206                 */
    31943207                updateInvitationVisibility: function ( optionalMenuItemControls ) {
    … …  
    32643277         * @alias wp.customize.Menus.applySavedData
    32653278         *
    3266          * @param {Object} data
    3267          * @param {Array} data.nav_menu_updates
    3268          * @param {Array} data.nav_menu_item_updates
     3279         * @param {Object}   data                       Data returned in the customize_save response.
     3280         * @param {Object[]} data.nav_menu_updates      Result of saving each nav menu, with term_id, previous_term_id, error, status, and saved_value properties.
     3281         * @param {Object[]} data.nav_menu_item_updates Result of saving each nav menu item, with post_id, previous_post_id, error, and status properties.
    32693282         */
    32703283        api.Menus.applySavedData = function( data ) {
    … …  
    34963509         * @alias wp.customize.Menus.focusMenuItemControl
    34973510         *
    3498          * @param {string} menuItemId
     3511         * @param {string} menuItemId The ID of the menu item whose control to focus.
    34993512         */
    35003513        api.Menus.focusMenuItemControl = function( menuItemId ) {
    … …  
    35103523         * @alias wp.customize.Menus.getMenuControl
    35113524         *
    3512          * @param menuId
    3513          * @return {wp.customize.controlConstructor.menus[]}
     3525         * @param {string|number} menuId The ID of the menu.
     3526         * @return {wp.customize.Menus.MenuControl|undefined} The menu control, or undefined if not found.
    35143527         */
    35153528        api.Menus.getMenuControl = function( menuId ) {
    … …  
    35223535         * @alias wp.customize.Menus.getMenuItemControl
    35233536         *
    3524          * @param {string} menuItemId
    3525          * @return {Object|null}
     3537         * @param {string} menuItemId The ID of the menu item.
     3538         * @return {wp.customize.Menus.MenuItemControl|undefined} The menu item control, or undefined if not found.
    35263539         */
    35273540        api.Menus.getMenuItemControl = function( menuItemId ) {
    … …  
    35323545         * @alias wp.customize.Menus~menuItemIdToSettingId
    35333546         *
    3534          * @param {string} menuItemId
     3547         * @param {string} menuItemId The ID of the menu item.
     3548         * @return {string} The setting ID for the menu item.
    35353549         */
    35363550        function menuItemIdToSettingId( menuItemId ) {
    … …  
    35443558         * @alias wp.customize.Menus~displayNavMenuName
    35453559         *
    3546          * @param {string} name
    3547          * @return {string}
     3560         * @param {string} [name] The menu name.
     3561         * @return {string} The sanitized display name, or a fallback "unnamed" string if empty.
    35483562         */
    35493563        function displayNavMenuName( name ) {
  • trunk/src/js/_enqueues/wp/customize/widgets.js

    r58455 r63456  
    44
    55/* global _wpCustomizeWidgetsSettings */
     6
     7/**
     8 * @param {Object}       wp The WordPress global object.
     9 * @param {JQueryStatic} $  The jQuery object.
     10 */
    611(function( wp, $ ){
    712
    … …  
    252257                /**
    253258                 * Updates the count of the available widgets that have the `search_matched` attribute.
    254                  */
     259                 */
    255260                updateSearchMatchesCount: function() {
    256261                        this.searchMatchesCount = this.collection.where({ search_matched: true }).length;
    … …  
    272277                /**
    273278                 * Changes visibility of available widgets.
    274                  */
     279                 */
    275280                updateList: function() {
    276281                        this.collection.each( function( widget ) {
    … …  
    285290                /**
    286291                 * Highlights a widget.
    287                  */
     292                 *
     293                 * @param {JQuery} widgetTpl The widget template to highlight.
     294                 */
    288295                select: function( widgetTpl ) {
    289296                        this.selected = $( widgetTpl );
    … …  
    294301                /**
    295302                 * Highlights a widget on focus.
     303                 *
     304                 * @param {JQuery.Event} event The focus event.
    296305                 */
    297306                focus: function( event ) {
    … …  
    301310                /**
    302311                 * Handles submit for keypress and click on widget.
     312                 *
     313                 * @param {JQuery.Event} event The keypress or click event.
    303314                 */
    304315                _submit: function( event ) {
    … …  
    313324                /**
    314325                 * Adds a selected widget to the sidebar.
    315                  */
     326                 *
     327                 * @param {JQuery} widgetTpl The widget template to add.
     328                 */
    316329                submit: function( widgetTpl ) {
    317330                        var widgetId, widget, widgetFormControl;
    … …  
    343356                /**
    344357                 * Opens the panel.
     358                 *
     359                 * @param {wp.customize.Widgets.SidebarControl} sidebarControl The sidebar control that opened the panel.
    345360                 */
    346361                open: function( sidebarControl ) {
    … …  
    372387                /**
    373388                 * Closes the panel.
     389                 *
     390                 * @param {Object} [options] Options for closing the panel.
    374391                 */
    375392                close: function( options ) {
    … …  
    390407                /**
    391408                 * Adds keyboard accessibility to the panel.
     409                 *
     410                 * @param {JQuery.Event} event The keydown event.
    392411                 */
    393412                keyboardAccessible: function( event ) {
    … …  
    458477
    459478                /**
    460                  * @param {jQuery.Event} e
    461                  * @param {jQuery} widget
    462                  * @param {string} newForm
     479                 * @param {JQuery.Event} e       The widget-synced event.
     480                 * @param {JQuery}       widget  The widget root element.
     481                 * @param {string}       newForm The HTML for the updated widget form.
    463482                 */
    464483                rss: function( e, widget, newForm ) {
    … …  
    492511                 * @constructs wp.customize.Widgets.WidgetControl
    493512                 * @augments   wp.customize.Control
     513                 *
     514                 * @param {string} id      Control ID.
     515                 * @param {Object} options Control options.
    494516                 */
    495517                initialize: function( id, options ) {
    … …  
    745767
    746768                        /**
    747                          * select the provided sidebar list item in the move widget area
     769                         * Selects the provided sidebar list item in the move widget area.
    748770                         *
    749                          * @param {jQuery} li
     771                         * @param {JQuery} li The sidebar list item to select.
    750772                         */
    751773                        selectSidebarItem = function( li ) {
    … …  
    954976                        formSyncHandler = api.Widgets.formSyncHandlers[ this.params.widget_id_base ];
    955977                        if ( formSyncHandler ) {
    956                                 $( document ).on( 'widget-synced', function( e, widget ) {
     978                                $( document ).on( 'widget-synced', function( e, widget, ...args ) {
    957979                                        if ( $widgetRoot.is( widget ) ) {
    958                                                 formSyncHandler.apply( document, arguments );
     980                                                formSyncHandler.call( document, e, widget, ...args );
    959981                                        }
    960982                                } );
    … …  
    969991                 * @since 4.1.0
    970992                 *
    971                  * @param {boolean}   active
    972                  * @param {Object}    args
    973                  * @param {function}  args.completeCallback
     993                 * @param {boolean}  active                Whether the widget is rendered.
     994                 * @param {Object}   args                  Args.
     995                 * @param {Function} args.completeCallback Function to call once the class has been toggled.
    974996                 */
    975997                onChangeActive: function ( active, args ) {
    … …  
    10401062                 * over when copying sanitized values over to the form loaded.
    10411063                 *
    1042                  * @param {jQuery} container element in which to look for inputs
    1043                  * @return {jQuery} inputs
     1064                 * @param {JQuery} container Element in which to look for inputs.
     1065                 * @return {JQuery} The inputs found within the container.
    10441066                 * @private
    10451067                 */
    … …  
    10521074                 * This string can be used to compare whether or not the form has all of the same fields.
    10531075                 *
    1054                  * @param {jQuery} inputs
    1055                  * @return {string}
     1076                 * @param {JQuery} inputs The inputs to build a signature from.
     1077                 * @return {string} Signature string for the inputs.
    10561078                 * @private
    10571079                 */
    … …  
    10751097                 * Get the state for an input depending on its type.
    10761098                 *
    1077                  * @param {jQuery|Element} input
    1078                  * @return {string|boolean|Array|*}
     1099                 * @param {JQuery|Element} input The input to read the state from.
     1100                 * @return {string|boolean|string[]|*} State of the input.
    10791101                 * @private
    10801102                 */
    … …  
    10951117                 * Update an input's state based on its type.
    10961118                 *
    1097                  * @param {jQuery|Element} input
    1098                  * @param {string|boolean|Array|*} state
     1119                 * @param {JQuery|Element}            input The input element to update.
     1120                 * @param {string|boolean|string[]|*} state The state to apply: the checked state for checkboxes and radio buttons, an array of values for multi-selects, and otherwise the input's value.
    10991121                 * @private
    11001122                 */
    … …  
    11251147
    11261148                /**
    1127                  * @return {wp.customize.controlConstructor.sidebar_widgets[]}
     1149                 * Get the sidebar widgets control for the sidebar this widget is in.
     1150                 *
     1151                 * @return {wp.customize.Widgets.SidebarControl|undefined} The sidebar widgets control, or undefined if not found.
    11281152                 */
    11291153                getSidebarWidgetsControl: function() {
    … …  
    11441168                 * along with the new widget control form to render.
    11451169                 *
    1146                  * @param {Object} [args]
    1147                  * @param {Object|null} [args.instance=null]  When the model changes, the instance is sent here; otherwise, the inputs from the form are used
    1148                  * @param {Function|null} [args.complete=null]  Function which is called when the request finishes. Context is bound to the control. First argument is any error. Following arguments are for success.
    1149                  * @param {boolean} [args.ignoreActiveElement=false] Whether or not updating a field will be deferred if focus is still on the element.
     1170                 * @param {Object}        [args]                           Arguments for the update.
     1171                 * @param {Object|null}   [args.instance=null]             When the model changes, the instance is sent here; otherwise, the inputs from the form are used.
     1172                 * @param {Function|null} [args.complete=null]             Function which is called when the request finishes. Context is bound to the control. First argument is any error. Following arguments are for success.
     1173                 * @param {boolean}       [args.ignoreActiveElement=false] Whether or not updating a field will be deferred if focus is still on the element.
    11501174                 */
    11511175                updateWidget: function( args ) {
    … …  
    13421366                 * @since 4.1.0
    13431367                 *
    1344                  * @param {Boolean} expanded
    1345                  * @param {Object} [params]
    1346                  * @return {Boolean} False if state already applied.
     1368                 * @param {boolean} expanded The new state to apply.
     1369                 * @param {Object}  [params] Object containing options for expand/collapse.
     1370                 * @return {boolean} False if state already applied.
    13471371                 */
    13481372                _toggleExpanded: api.Section.prototype._toggleExpanded,
    … …  
    13511375                 * @since 4.1.0
    13521376                 *
    1353                  * @param {Object} [params]
    1354                  * @return {Boolean} False if already expanded.
     1377                 * @param {Object} [params] Object containing options for expansion.
     1378                 * @return {boolean} False if already expanded.
    13551379                 */
    13561380                expand: api.Section.prototype.expand,
    … …  
    13681392                 * @since 4.1.0
    13691393                 *
    1370                  * @param {Object} [params]
    1371                  * @return {Boolean} False if already collapsed.
     1394                 * @param {Object} [params] Object containing options for collapse.
     1395                 * @return {boolean} False if already collapsed.
    13721396                 */
    13731397                collapse: api.Section.prototype.collapse,
    … …  
    13871411                 * @deprecated this is poor naming, and it is better to directly set control.expanded( showOrHide )
    13881412                 *
    1389                  * @param {boolean|undefined} [showOrHide] If not supplied, will be inverse of current visibility
     1413                 * @param {boolean|undefined} [showOrHide] If not supplied, will be inverse of current visibility.
    13901414                 */
    13911415                toggleForm: function( showOrHide ) {
    … …  
    13991423                 * Respond to change in the expanded state.
    14001424                 *
    1401                  * @param {boolean} expanded
    1402                  * @param {Object} args  merged on top of this.defaultActiveArguments
     1425                 * @param {boolean}  expanded              The expanded state to transition to.
     1426                 * @param {Object}   args                  Object containing options for expand/collapse, merged on top of this.defaultExpandedArguments.
     1427                 * @param {boolean}  [args.unchanged]      Whether the expanded state is unchanged.
     1428                 * @param {Function} args.completeCallback Callback to be executed once the expand/collapse action is complete.
    14031429                 */
    14041430                onChangeExpanded: function ( expanded, args ) {
    … …  
    14991525                 * Get the position (index) of the widget in the containing sidebar
    15001526                 *
    1501                  * @return {number}
     1527                 * @return {number|void} Index of the widget in the sidebar, or undefined if not found.
    15021528                 */
    15031529                getWidgetSidebarPosition: function() {
    … …  
    15311557                 * @private
    15321558                 *
    1533                  * @param {number} offset 1|-1
     1559                 * @param {number} offset The number of positions to move the widget, either 1 or -1.
    15341560                 */
    15351561                _moveWidgetByOne: function( offset ) {
    … …  
    15501576                 * Toggle visibility of the widget move area
    15511577                 *
    1552                  * @param {boolean} [showOrHide]
     1578                 * @param {boolean} [showOrHide] If not supplied, will be inverse of current visibility.
    15531579                 */
    15541580                toggleWidgetMoveArea: function( showOrHide ) {
    … …  
    16061632         * @augments wp.customize.Panel
    16071633         */
    1608         api.Widgets.WidgetsPanel = api.Panel.extend(/** @lends wp.customize.Widgets.WigetsPanel.prototype */{
     1634        api.Widgets.WidgetsPanel = api.Panel.extend(/** @lends wp.customize.Widgets.WidgetsPanel.prototype */{
    16091635
    16101636                /**
    … …  
    16431669                                 * Determine whether or not the notice should be displayed.
    16441670                                 *
    1645                                  * @return {boolean}
     1671                                 * @return {boolean} True if the notice should be displayed, false otherwise.
    16461672                                 */
    16471673                                shouldShowNotice = function() {
    … …  
    17131739                 * @since 4.4.0
    17141740                 *
    1715                  * @return {boolean}
     1741                 * @return {boolean} True if the panel is contextually active, false otherwise.
    17161742                 */
    17171743                isContextuallyActive: function() {
    … …  
    20092035                 * Enable/disable the reordering UI
    20102036                 *
    2011                  * @param {boolean} showOrHide to enable/disable reordering
     2037                 * @param {boolean} showOrHide Whether to enable or disable reordering.
    20122038                 *
    20132039                 * @todo We should have a reordering state instead and rename this to onChangeReordering
    … …  
    20492075                 *
    20502076                 * @since 3.9.0
    2051                  * @return {wp.customize.controlConstructor.widget_form[]}
     2077                 * @return {wp.customize.Widgets.WidgetControl[]} Widget form controls associated with the current sidebar.
    20522078                 */
    20532079                getWidgetFormControls: function() {
    … …  
    20662092
    20672093                /**
    2068                  * @param {string} widgetId or an id_base for adding a previously non-existing widget.
    2069                  * @return {Object|false} widget_form control instance, or false on error.
     2094                 * Add a widget to the sidebar.
     2095                 *
     2096                 * @param {string} widgetId Widget ID, or an id_base for adding a previously non-existing widget.
     2097                 * @return {wp.customize.Widgets.WidgetControl|false} The widget_form control instance, or false on error.
    20702098                 */
    20712099                addWidget: function( widgetId ) {
    … …  
    22222250         * Highlight a widget control.
    22232251         *
    2224          * @param {string} widgetId
     2252         * @param {string} widgetId The ID of the widget to highlight.
    22252253         */
    22262254        api.Widgets.highlightWidgetFormControl = function( widgetId ) {
    … …  
    22352263         * Focus a widget control.
    22362264         *
    2237          * @param {string} widgetId
     2265         * @param {string} widgetId The ID of the widget to focus.
    22382266         */
    22392267        api.Widgets.focusWidgetFormControl = function( widgetId ) {
    … …  
    22472275        /**
    22482276         * Given a widget control, find the sidebar widgets control that contains it.
    2249          * @param {string} widgetId
    2250          * @return {Object|null}
     2277         * @param {string} widgetId The ID of the widget to find the sidebar widgets control for.
     2278         * @return {Object|null} Sidebar widgets control that contains the widget, or null if not found.
    22512279         */
    22522280        api.Widgets.getSidebarWidgetControlContainingWidget = function( widgetId ) {
    … …  
    22662294         * Given a widget ID for a widget appearing in the preview, get the widget form control associated with it.
    22672295         *
    2268          * @param {string} widgetId
    2269          * @return {Object|null}
     2296         * @param {string} widgetId The ID of the widget to find the form control for.
     2297         * @return {Object|null} Widget form control associated with the widget, or null if not found.
    22702298         */
    22712299        api.Widgets.getWidgetFormControlForWidget = function( widgetId ) {
    … …  
    23202348         * This overrides the back button to serve the purpose of breadcrumb navigation.
    23212349         *
    2322          * @param {wp.customize.Section|wp.customize.Panel|wp.customize.Control} focusConstruct - The object to initially focus.
    2323          * @param {wp.customize.Section|wp.customize.Panel|wp.customize.Control} returnConstruct - The object to return focus.
     2350         * @param {wp.customize.Section|wp.customize.Panel|wp.customize.Control} focusConstruct The object to initially focus.
     2351         * @param {wp.customize.Section|wp.customize.Panel|wp.customize.Control} returnConstruct The object to return focus.
    23242352         */
    23252353        function focusConstructWithBreadcrumb( focusConstruct, returnConstruct ) {
    … …  
    23352363
    23362364        /**
    2337          * @param {string} widgetId
    2338          * @return {Object}
     2365         * @param {string} widgetId The widget ID to parse.
     2366         * @return {Object} Parsed widget ID with id_base and number properties.
    23392367         */
    23402368        function parseWidgetId( widgetId ) {
    … …  
    23572385
    23582386        /**
    2359          * @param {string} widgetId
    2360          * @return {string} settingId
     2387         * @param {string} widgetId The widget ID.
     2388         * @return {string} The setting ID for the widget.
    23612389         */
    23622390        function widgetIdToSettingId( widgetId ) {
Note: See TracChangeset for help on using the changeset viewer.