Make WordPress Core

Changeset 63556


Ignore:
Timestamp:
09/09/2026 12:02:40 PM (2 months ago)
Author:
afercia
Message:

General: Add missing JS docblocks.

Also, enables the JSDoc rule jsdoc/require-jsdoc.
Part of the effort to improve JS inline documentation for 7.2.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13439

Props afercia, westonruter.
See #66033.

Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/.eslintrc-jsdoc.js

    r63525 r63556  
    5757                        'jsdoc/check-syntax': 'error',
    5858                        'jsdoc/require-description': 'error',
     59                        'jsdoc/require-jsdoc': 'error',
    5960                },
    6061        },
  • trunk/Gruntfile.js

    r63464 r63556  
    155155        };
    156156
    157         // Load grunt-* tasks.
     157        /**
     158         * Loads the Grunt tasks for the given dependency.
     159         *
     160         * @param {string} dependency The name of the Grunt task to load.
     161         */
    158162        function loadGruntTasks( dependency ) {
    159163                var contrib = key === 'contrib' ? 'contrib-' : '';
    … …  
    17981802                ] );
    17991803
     1804                /**
     1805                 * Searches for the first version control directory in the given set.
     1806                 *
     1807                 * @param {string[]} set Array of directory paths to check.
     1808                 */
    18001809                function find( set ) {
    18011810                        var dir;
    … …  
    18101819                }
    18111820
     1821                /**
     1822                 * Runs all tasks.
     1823                 */
    18121824                function runAllTasks() {
    18131825                        grunt.log.writeln( 'Cannot determine which files are modified as SVN and GIT are not available.' );
    … …  
    18251837                }
    18261838
     1839                /**
     1840                 * Determines which precommit tasks to run based on modified files detected by version control.
     1841                 *
     1842                 * @param {string} type The version control type: 'git' or 'svn'.
     1843                 */
    18271844                function run( type ) {
    18281845                        var command = map[ type ].split( ' ' );
    … …  
    18341851                                var taskList = [];
    18351852
    1836                                 // Callback for finding modified paths.
     1853                                /**
     1854                                 * Checks if the given path appears in the version control status output.
     1855                                 *
     1856                                 * @param {string} path The path to check.
     1857                                 * @return {boolean} True if the path is found, false otherwise.
     1858                                 */
    18371859                                function testPath( path ) {
    18381860                                        var regex = new RegExp( ' ' + path + '$', 'm' );
    … …  
    18401862                                }
    18411863
    1842                                 // Callback for finding modified files by extension.
     1864                                /**
     1865                                 * Checks if files with the given extension appear in the version control status output.
     1866                                 *
     1867                                 * @param {string} extension The file extension to check for.
     1868                                 * @return {boolean} True if the file with the given extension is found, false otherwise.
     1869                                 */
    18431870                                function testExtension( extension ) {
    18441871                                        var regex = new RegExp( '\.' + extension + '$', 'm' );
  • trunk/src/js/_enqueues/admin/password-toggle.js

    r56008 r63556  
     1/**
     2 * @output wp-admin/js/password-toggle.js
     3 */
     4
    15/**
    26 * Adds functionality for password visibility buttons to toggle between text and password input types.
    37 *
    48 * @since 6.3.0
    5  * @output wp-admin/js/password-toggle.js
    69 */
    7 
    810( function () {
    911        var toggleElements, status, input, icon, label, __ = wp.i18n.__;
    … …  
    1618        } );
    1719
     20        /**
     21         * Toggles the password input field visibility.
     22         */
    1823        function togglePassword() {
    1924                status = this.getAttribute( 'data-toggle' );
  • trunk/src/js/_enqueues/admin/plugin-install.js

    r62691 r63556  
    77/* global tb_click, tb_remove, tb_position */
    88
     9/**
     10 * Initializes the plugin install screens.
     11 *
     12 * @param {JQueryStatic} $ The jQuery object.
     13 */
    914jQuery( function( $ ) {
    1015
    … …  
    7984                });
    8085
     86        /**
     87         * Initializes the plugin details modal dialog after the iframe has fully loaded.
     88         */
    8189        function iframeLoaded() {
    8290                var $iframe = tbWindow.find( '#TB_iframeContent' );
    … …  
    110118        }
    111119
    112         /*
    113          * Get the tabbable elements and detach/attach the keydown event.
     120        /**
     121         * Gets the tabbable elements and detaches/attaches the keydown event.
     122         *
    114123         * Called after the iframe has fully loaded so we have all the elements we need.
    115124         * Called again each time a Tab gets clicked.
    … …  
    134143        }
    135144
    136         // Constrain tabbing within the plugin modal dialog.
     145        /**
     146         * Constrains tabbing within the plugin modal dialog.
     147         *
     148         * @param {JQuery.Event} event The keydown event.
     149         */
    137150        function constrainTabbing( event ) {
    138151                if ( 9 !== event.which ) {
    … …  
    149162        }
    150163
    151         /*
    152          * Open the Plugin details modal. The event is delegated to get also the links
    153          * in the plugins search tab, after the Ajax search rebuilds the HTML. It's
    154          * delegated on the closest ancestor and not on the body to avoid conflicts
    155          * with other handlers, see Trac ticket #43082.
     164        /**
     165         * Opens the Plugin details modal.
     166         *
     167         * The event is delegated to get also the links in the plugins search tab,
     168         * after the Ajax search rebuilds the HTML. It's delegated on the closest
     169         * ancestor and not on the body to avoid conflicts with other handlers, see
     170         * Trac ticket #43082.
    156171         */
    157172        $( '.wrap' ).on( 'click', '.thickbox.open-plugin-details-modal', function( e ) {
  • trunk/src/js/_enqueues/admin/privacy-tools.js

    r62663 r63556  
    11/**
    2  * Interactions used by the User Privacy tools in WordPress.
    3  *
    42 * @output wp-admin/js/privacy-tools.js
    53 */
    64
    7 // Privacy request action handling.
     5/**
     6 * Sets the interactions used by the User Privacy tools in WordPress.
     7 *
     8 * @param {jQueryStatic} $ The jQuery object.
     9 */
    810jQuery( function( $ ) {
    911        var __ = wp.i18n.__,
    1012                copiedNoticeTimeout;
    1113
     14        /**
     15         * Sets the state of the action.
     16         *
     17         * @param {jQuery} $action The action to set the state for.
     18         * @param {string} state   The state to set the action to.
     19         * @return {void}
     20         */
    1221        function setActionState( $action, state ) {
    1322                $action.children().addClass( 'hidden' );
    … …  
    1524        }
    1625
     26        /**
     27         * Clears any results row after the request row.
     28         *
     29         * @param {jQuery} $requestRow The request row to clear results for.
     30         * @return {void}
     31         */
    1732        function clearResultsAfterRow( $requestRow ) {
    1833                $requestRow.removeClass( 'has-request-results' );
    … …  
    2338        }
    2439
     40        /**
     41         * Appends a results row after the request row.
     42         *
     43         * @param {jQuery}   $requestRow        The request row to append the results after.
     44         * @param {string}   classes            The classes to add to the results row.
     45         * @param {string}   summaryMessage     The summary message to display in the results row.
     46         * @param {string[]} additionalMessages Additional messages to display in the results row.
     47         * @return {void}
     48         */
    2549        function appendResultsAfterRow( $requestRow, classes, summaryMessage, additionalMessages ) {
    2650                var itemList = '',
    … …  
    77101                setExportProgress( 0 );
    78102
     103                /**
     104                 * Handles a successful export.
     105                 *
     106                 * @param {string} zipUrl The URL of the generated ZIP file, if available.
     107                 * @return {void}
     108                 */
    79109                function onExportDoneSuccess( zipUrl ) {
    80110                        var summaryMessage = __( 'This user’s personal data export link was sent.' );
    … …  
    97127                }
    98128
     129                /**
     130                 * Handles an export failure.
     131                 *
     132                 * @param {string} errorMessage The error message to display.
     133                 * @return {void}
     134                 */
    99135                function onExportFailure( errorMessage ) {
    100136                        var summaryMessage = __( 'An error occurred while attempting to export personal data.' );
    … …  
    109145                }
    110146
     147                /**
     148                 * Updates the progress of the export process.
     149                 *
     150                 * @param {number} exporterIndex The index of the exporter to process.
     151                 * @return {void}
     152                 */
    111153                function setExportProgress( exporterIndex ) {
    112154                        var progress       = ( exportersCount > 0 ? exporterIndex / exportersCount : 0 ),
    … …  
    116158                }
    117159
     160                /**
     161                 * Performs the next export request.
     162                 *
     163                 * @param {number} exporterIndex The index of the exporter to process.
     164                 * @param {number} pageIndex     The index of the page to process for the current exporter.
     165                 * @return {void}
     166                 */
    118167                function doNextExport( exporterIndex, pageIndex ) {
    119168                        $.ajax(
    … …  
    182231                setErasureProgress( 0 );
    183232
     233                /**
     234                 * Handles a successful erasure.
     235                 *
     236                 * @return {void}
     237                 */
    184238                function onErasureDoneSuccess() {
    185239                        var summaryMessage = __( 'No personal data was found for this user.' ),
    … …  
    208262                }
    209263
     264                /**
     265                 * Handles an erasure failure.
     266                 */
    210267                function onErasureFailure() {
    211268                        var summaryMessage = __( 'An error occurred while attempting to find and erase personal data.' );
    … …  
    218275                }
    219276
     277                /**
     278                 * Updates the progress of the erasure process.
     279                 *
     280                 * @param {number} eraserIndex The index of the eraser to process.
     281                 * @return {void}
     282                 */
    220283                function setErasureProgress( eraserIndex ) {
    221284                        var progress       = ( erasersCount > 0 ? eraserIndex / erasersCount : 0 ),
    … …  
    225288                }
    226289
     290                /**
     291                 * Performs the next erasure request.
     292                 *
     293                 * @param {number} eraserIndex The index of the eraser to process.
     294                 * @param {number} pageIndex   The index of the page to process for the current eraser.
     295                 * @return {void}
     296                 */
    227297                function doNextErasure( eraserIndex, pageIndex ) {
    228298                        $.ajax({
  • trunk/src/js/_enqueues/admin/site-health.js

    r63406 r63556  
    11/**
    2  * Interactions used by the Site Health modules in WordPress.
    3  *
    42 * @output wp-admin/js/site-health.js
    53 */
    … …  
    75/* global ajaxurl, ClipboardJS, SiteHealth, wp */
    86
     7/**
     8 * Handles the interactions used by the Site Health modules in WordPress.
     9 *
     10 * @param {JQueryStatic} $ The jQuery object.
     11 */
    912jQuery( function( $ ) {
    1013
    … …  
    394397        }
    395398
     399        /**
     400         * Get the sizes of the directories in the Site Health Info section.
     401         */
    396402        function getDirectorySizes() {
    397403                var timestamp = ( new Date().getTime() );
    … …  
    435441        }
    436442
     443        /**
     444         * Updates the directory sizes in the Site Health Info section.
     445         *
     446         * @param {Object} data The directory sizes data.
     447         */
    437448        function updateDirSizes( data ) {
    438449                var copyButton = $( 'button.button.copy-button' );
  • trunk/src/js/_enqueues/admin/tags-suggest.js

    r63406 r63556  
     1/**
     2 * @output wp-admin/js/tags-suggest.js
     3 */
     4
    15/**
    26 * Default settings for jQuery UI Autocomplete for use with non-hierarchical taxonomies.
    3  *
    4  * @output wp-admin/js/tags-suggest.js
    57 *
    68 * @param {JQueryStatic} $ The jQuery object.
    … …  
    1315            sprintf = wp.i18n.sprintf;
    1416
     17        /**
     18         * Splits a string into an array of terms based on the separator.
     19         *
     20         * @param {string} val The string to split.
     21         * @return {string[]} An array of terms.
     22         */
    1523        function split( val ) {
    1624                return val.split( new RegExp( separator + '\\s*' ) );
    1725        }
    1826
     27        /**
     28         * Gets the last term from a string based on the separator.
     29         *
     30         * @param {string} term The string to get the last term from.
     31         * @return {string} The last term.
     32         */
    1933        function getLast( term ) {
    2034                return split( term ).pop();
    … …  
    2236
    2337        /**
    24          * Add UI Autocomplete to an input or textarea element with presets for use
     38         * Adds UI Autocomplete to an input or textarea element with presets for use
    2539         * with non-hierarchical taxonomies.
    2640         *
  • trunk/src/js/_enqueues/admin/user-profile.js

    r63514 r63556  
    3333                isFirefox = ua.indexOf( 'firefox' ) !== -1;
    3434
     35        /**
     36         * Generates a password and updates the password input field.
     37         *
     38         * If zxcvbn is not yet loaded, it will wait and try again. If the password
     39         * input field is empty or the password wrapper is open, it will set the
     40         * password to the generated value. If the user has already entered a
     41         * password, it will check the strength of that password. It also binds
     42         * the toggle button to show or hide the password and sets the initial state
     43         * of the toggle button based on whether the password should be masked or
     44         * not. Finally, it updates the label for confirming weak passwords.
     45         */
    3546        function generatePassword() {
    3647                if ( typeof zxcvbn !== 'function' ) {
    … …  
    6879        }
    6980
     81        /**
     82         * Binds the password input field to update the current password and refresh the password strength area when the user types in the field.
     83         */
    7084        function bindPass1() {
    7185                currentPass = $pass1.val();
    … …  
    90104        }
    91105
     106        /**
     107         * Resets the toggle button to show or hide the password.
     108         *
     109         * @param {boolean} show Whether to show the password or not.
     110         */
    92111        function resetToggle( show ) {
    93112                $toggleButton
    … …  
    103122        }
    104123
     124        /**
     125         * Binds the toggle button to show or hide the password. Also ensures that the password input type is set to password when the form is submitted.
     126         */
    105127        function bindToggleButton() {
    106128                if ( !! $toggleButton ) {
    … …  
    194216        }
    195217
     218        /**
     219         * Initializes the password form, including the password strength meter, weak password checkbox, and show/hide password toggle button.
     220         */
    196221        function bindPasswordForm() {
    197222                var $generateButton,
    … …  
    310335        }
    311336
     337        /**
     338         * Sets CSS classes to the password strength results based on the password strength.
     339         */
    312340        function check_pass_strength() {
    313341                var pass1 = $('#pass1').val(), strength;
    … …  
    415443        }
    416444
     445        /**
     446         * Toggles the visibility of the weak password checkbox.
     447         */
    417448        function showOrHideWeakPasswordCheckbox() {
    418449                var passStrengthResult = $('#pass-strength-result');
  • trunk/src/js/_enqueues/lib/embed-template.js

    r63403 r63556  
    66 * IIFE setup function.
    77 *
    8  * @param {Window} window Global window object.
    9  * @param {Document} document Global document object.
     8 * @param {Window}   window   The global window object.
     9 * @param {Document} document The global document object.
    1010 */
    1111(function ( window, document ) {
    … …  
    1818                resizing;
    1919
     20        /**
     21         * Sends a message to the parent window.
     22         *
     23         * @param {string} message The message type (e.g., 'height', 'link').
     24         * @param {*}      value   The message value. Type depends on message (number for height, string for link).
     25         */
    2026        function sendEmbedMessage( message, value ) {
    2127                window.parent.postMessage( {
  • trunk/src/js/_enqueues/lib/link.js

    r59696 r63556  
    33 */
    44
    5  /* global wpLink */
    6 
     5/* global wpLink */
     6
     7/**
     8 * The WordPress Link Modal dialog.
     9 *
     10 * @param {JQueryStatic} $          The jQuery object.
     11 * @param {Object}       wpLinkL10n The WordPress Link localization object.
     12 * @param {Object}       wp         The WordPress global object.
     13 */
    714( function( $, wpLinkL10n, wp ) {
    815        var editor, searchTimer, River, Query, correctedURL,
    … …  
    1320                isTouch = ( 'ontouchend' in document );
    1421
     22        /**
     23         * Gets the currently selected link in the editor.
     24         *
     25         * @return {JQuery} The currently selected link element.
     26         */
    1527        function getLink() {
    1628                if ( editor ) {
  • trunk/src/js/_enqueues/lib/nav-menu.js

    r63514 r63556  
    10141014                        });
    10151015
     1016                        /**
     1017                         * Updates the shared variables used to determine the depth of the menu item being moved.
     1018                         *
     1019                         * @param {Object} ui The jQuery UI object for the menu item being moved.
     1020                         */
    10161021                        function updateSharedVars(ui) {
    10171022                                var depth;
    … …  
    10341039                        }
    10351040
     1041                        /**
     1042                         * Updates the current depth of the menu item being moved.
     1043                         *
     1044                         * @param {Object} ui    The jQuery UI object for the menu item being moved.
     1045                         * @param {number} depth The new depth of the menu item being moved.
     1046                         * @return {void}
     1047                         */
    10361048                        function updateCurrentDepth(ui, depth) {
    10371049                                ui.placeholder.updateDepthClass( depth, currentDepth );
    … …  
    10391051                        }
    10401052
     1053                        /**
     1054                         * Determines the initial menu max depth class on the body element.
     1055                         *
     1056                         * @return {number} The initial menu max depth.
     1057                         */
    10411058                        function initialMenuMaxDepth() {
    10421059                                if( ! body[0].className ) return 0;
    … …  
    10451062                        }
    10461063
     1064                        /**
     1065                         * Updates the menu max depth class on the body element.
     1066                         *
     1067                         * @param {number} depthChange The change in depth of the menu item being moved.
     1068                         * @return {void}
     1069                         */
    10471070                        function updateMenuMaxDepth( depthChange ) {
    10481071                                var depth, newDepth = menuMaxDepth;
  • trunk/src/js/_enqueues/lib/quicktags.js

    r63407 r63556  
    234234        };
    235235
     236        /**
     237         * Escapes HTML special characters in a string.
     238         *
     239         * @param {string} text The string to escape.
     240         * @return {string} The escaped string.
     241         */
    236242        function _escape( text ) {
    237243                text = text || '';
    … …  
    249255                var t = this;
    250256
     257                /**
     258                 * Initializes the Quicktags buttons for a specific instance.
     259                 *
     260                 * @param {string} instanceId The ID of the Quicktags instance to initialize buttons for.
     261                 */
    251262                function _init( instanceId ) {
    252263                        var canvas, name, settings, theButtons, html, ed, id, i, use,
  • trunk/src/js/_enqueues/wp/api-request.js

    r63514 r63556  
    2222        var wpApiSettings = window.wpApiSettings;
    2323
     24        /**
     25         * Makes an API request.
     26         *
     27         * @param {Object} options                 The options for the API request.
     28         * @param {string} [options.url]           The full URL for the request.
     29         * @param {string} [options.path]          The API path (e.g., 'wp/v2/posts'). Used if url is not provided.
     30         * @param {string} [options.namespace]     The API namespace (e.g., 'wp/v2'). Used with endpoint to build path.
     31         * @param {string} [options.endpoint]      The API endpoint (e.g., 'posts'). Used with namespace to build path.
     32         * @param {string} [options.method]        The HTTP method (GET, POST, PUT, DELETE, etc.).
     33         * @param {Object} [options.data]          The request data to send.
     34         * @param {string} [options.data._wpnonce] Nonce for security.
     35         * @param {Object} [options.headers]       Custom headers to include in the request.
     36         * @return {JQueryXHR} The jQuery XHR object.
     37         */
    2438        function apiRequest( options ) {
    2539                options = apiRequest.buildAjaxOptions( options );
    … …  
    2741        }
    2842
     43        /**
     44         * Builds the options for the jQuery.ajax request.
     45         *
     46         * @param {Object} options             The options for the API request.
     47         * @param {string} [options.url]       The full URL for the request.
     48         * @param {string} [options.path]      The API path (e.g., 'wp/v2/posts'). Used if url is not provided.
     49         * @param {string} [options.namespace] The API namespace (e.g., 'wp/v2'). Used with endpoint to build path.
     50         * @param {string} [options.endpoint]  The API endpoint (e.g., 'posts'). Used with namespace to build path.
     51         * @param {string} [options.method]    The HTTP method (GET, POST, PUT, DELETE, etc.).
     52         * @param {Object} [options.data]      The request data to send.
     53         * @param {Object} [options.headers]   Custom headers to include in the request.
     54         * @return {Object} The options for the jQuery.ajax request.
     55         */
    2956        apiRequest.buildAjaxOptions = function( options ) {
    3057                var url = options.url;
  • trunk/src/js/_enqueues/wp/autosave.js

    r63407 r63556  
    450450                         */
    451451                        function compare( str1, str2 ) {
     452                                /**
     453                                 * Removes all whitespace characters from a string.
     454                                 *
     455                                 * @param {string} string The string to remove whitespace from.
     456                                 * @return {string} The string without whitespace characters.
     457                                 */
    452458                                function removeSpaces( string ) {
    453459                                        return string.toString().replace(/[\x20\t\r\n\f]+/g, '');
  • trunk/src/js/_enqueues/wp/custom-header.js

    r63407 r63556  
    245245                var prop;
    246246
     247                /**
     248                 * Creates a custom handler instance.
     249                 *
     250                 * @return {CustomHandler} A custom handler instance, when called with new.
     251                 */
    247252                function CustomHandler() {
    248253                        var result = BaseHandler.apply( this, arguments );
  • trunk/src/js/_enqueues/wp/customize/controls.js

    r63525 r63556  
    844844                );
    845845
     846                /**
     847                 * Cancels the reminder, preventing the button from being highlighted.
     848                 */
    846849                function cancelReminder() {
    847850                        canceled = true;
    … …  
    19821985                        });
    19831986
     1987                        /**
     1988                         * Updates the section header to reflect the expanded state.
     1989                         */
    19841990                        function updateSelectedState() {
    19851991                                var el = section.headerContainer.find( '.customize-themes-section-title' );
    … …  
    20262032                        }
    20272033
     2034                        /**
     2035                         * Expands the section.
     2036                         */
    20282037                        function expand() {
    20292038
    … …  
    26262635                                .focus();
    26272636
     2637                        /**
     2638                         * Disables the switch buttons if the theme cannot be switched to.
     2639                         *
     2640                         * @return {boolean} True if the switch buttons should be disabled, false otherwise.
     2641                         */
    26282642                        function disableSwitchButtons() {
    26292643                                return ! panel.canSwitchTheme( theme.id );
    … …  
    26312645
    26322646                        // Temporary special function since supplying SFTP credentials does not work yet. See #42184.
     2647                        /**
     2648                         * Disables the install buttons if the theme cannot be installed or if filesystem credentials are needed.
     2649                         *
     2650                         * @return {boolean} True if the install buttons should be disabled, false otherwise.
     2651                         */
    26332652                        function disableInstallButtons() {
    26342653                                return disableSwitchButtons() || false === api.settings.theme._canInstall || true === api.settings.theme._filesystemCredentialsNeeded;
    … …  
    31383157                        }
    31393158
     3159                        /**
     3160                         * Toggles the theme switch unavailable notification based on whether switching is possible.
     3161                         */
    31403162                        function toggleDisabledNotifications() {
    31413163                                if ( panel.canSwitchTheme() ) {
    … …  
    52165238                        var control = this, panel = api.panel( 'themes' );
    52175239
     5240                        /**
     5241                         * Disables the preview buttons if the theme cannot be switched to.
     5242                         *
     5243                         * @return {boolean} True if the preview buttons should be disabled, false otherwise.
     5244                         */
    52185245                        function disableSwitchButtons() {
    52195246                                return ! panel.canSwitchTheme( control.params.theme.id );
    … …  
    52215248
    52225249                        // Temporary special function since supplying SFTP credentials does not work yet. See #42184.
     5250                        /**
     5251                         * Disables the install buttons if the theme cannot be installed or if filesystem credentials are needed.
     5252                         *
     5253                         * @return {boolean} True if the install buttons should be disabled, false otherwise.
     5254                         */
    52235255                        function disableInstallButtons() {
    52245256                                return disableSwitchButtons() || false === api.settings.theme._canInstall || true === api.settings.theme._filesystemCredentialsNeeded;
    52255257                        }
     5258
     5259                        /**
     5260                         * Updates the state of the preview and install buttons based on whether the theme can be switched to or installed.
     5261                         */
    52265262                        function updateButtons() {
    52275263                                control.container.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() );
    … …  
    73377373                        section.active.bind( updateButtonsState );
    73387374
     7375                        /**
     7376                         * Highlights the schedule button to remind the user to schedule the changes.
     7377                         */
    73397378                        function highlightScheduleButton() {
    73407379                                if ( ! cancelScheduleButtonReminder ) {
    … …  
    73517390                                }
    73527391                        }
     7392
     7393                        /**
     7394                         * Cancels the highlight reminder for the schedule button.
     7395                         */
    73537396                        function cancelHighlightScheduleButton() {
    73547397                                if ( cancelScheduleButtonReminder ) {
    … …  
    75927635                                api.state( 'saving' ).set( true );
    75937636
     7637                                /**
     7638                                 * Captures a setting as modified during the save process.
     7639                                 *
     7640                                 * @param {wp.customize.Setting} setting The setting that was modified.
     7641                                 */
    75947642                                function captureSettingModifiedDuringSave( setting ) {
    75957643                                        modifiedWhileSaving[ setting.id ] = true;
    … …  
    89348982                        var isInsideIframe = false;
    89358983
     8984                        /**
     8985                         * Determine whether the Customizer is in a clean state.
     8986                         *
     8987                         * @return {boolean} True if the Customizer is in a clean state, false otherwise.
     8988                         */
    89368989                        function isCleanState() {
    89378990                                var defaultChangesetStatus;
    … …  
    89709023                        });
    89719024
     9025                        /**
     9026                         * Starts prompting the user before unloading the Customizer if there are unsaved changes.
     9027                         */
    89729028                        function startPromptingBeforeUnload() {
    89739029                                api.unbind( 'change', startPromptingBeforeUnload );
    … …  
    89899045                        api.state( 'selectedChangesetDate' ).bind( startPromptingBeforeUnload );
    89909046
     9047                        /**
     9048                         * Requests to close the Customizer, prompting the user to save changes if necessary.
     9049                         *
     9050                         * @return {JQuery.Promise} A promise that resolves if the user is cleared to close the Customizer, or rejects if the user cancels the close.
     9051                         */
    89919052                        function requestClose() {
    89929053                                var clearedToClose = $.Deferred(), dismissAutoSave = false, dismissLock = false;
    … …  
    93789439                } );
    93799440
    9380                 // Autosave changeset.
     9441                /**
     9442                 * Starts autosaving changeset when a change is made.
     9443                 */
    93819444                function startAutosaving() {
    93829445                        var timeoutId, updateChangesetWithReschedule, scheduleChangesetUpdate, updatePending = false;
    … …  
    93849447                        api.unbind( 'change', startAutosaving ); // Ensure startAutosaving only fires once.
    93859448
     9449                        /**
     9450                         * Handles changes to the saved state of the changeset.
     9451                         *
     9452                         * @param {boolean} isSaved Whether the changeset is saved or not.
     9453                         */
    93869454                        function onChangeSaved( isSaved ) {
    93879455                                if ( ! isSaved && ! api.settings.changeset.autosaved ) {
  • trunk/src/js/_enqueues/wp/customize/widgets.js

    r63525 r63556  
    23592359        function focusConstructWithBreadcrumb( focusConstruct, returnConstruct ) {
    23602360                focusConstruct.focus();
     2361                /**
     2362                 * Determines whether to return focus to the returnConstruct after the focusConstruct is collapsed.
     2363                 *
     2364                 * @param {boolean} isExpanded Whether the focusConstruct is expanded.
     2365                 */
    23612366                function onceCollapsed( isExpanded ) {
    23622367                        if ( ! isExpanded ) {
  • trunk/src/js/_enqueues/wp/editor/base.js

    r63407 r63556  
    55window.wp = window.wp || {};
    66
     7/**
     8 * The editor functionality.
     9 *
     10 * @param {JQueryStatic} $  The jQuery object.
     11 * @param {Object}       wp The WordPress global object.
     12 */
    713( function( $, wp ) {
    814        wp.editor = wp.editor || {};
    … …  
    1824                        exports = {};
    1925
     26                /**
     27                 * Initializes the editor utility functions.
     28                 */
    2029                function init() {
    2130                        if ( ! tinymce && window.tinymce ) {
  • trunk/src/js/_enqueues/wp/editor/dfw.js

    r63514 r63556  
    13611361                                var position = document.activeElement.compareDocumentPosition( $editor.get( 0 ) );
    13621362
     1363                                /**
     1364                                 * Determines whether the passed element has focus.
     1365                                 *
     1366                                 * @param {jQuery} $el The element to check for focus.
     1367                                 * @return {boolean} True if the element has focus, false otherwise.
     1368                                 */
    13631369                                function hasFocus( $el ) {
    13641370                                        return $.contains( $el.get( 0 ), document.activeElement );
    … …  
    15251531                        var mceBind, mceUnbind;
    15261532
     1533                        /**
     1534                         * Tracks when the TinyMCE editor receives focus.
     1535                         */
    15271536                        function focus() {
    15281537                                editorHasFocus = true;
    15291538                        }
    15301539
     1540                        /**
     1541                         * Tracks when the TinyMCE editor loses focus.
     1542                         */
    15311543                        function blur() {
    15321544                                editorHasFocus = false;
  • trunk/src/js/_enqueues/wp/embed.js

    r63407 r63556  
    8888        };
    8989
     90        /**
     91         * Initializes the embed script on DOMContentLoaded.
     92         */
    9093        function onLoad() {
    9194                var iframes = document.querySelectorAll( 'iframe.wp-embedded-content' ),
  • trunk/src/js/_enqueues/wp/mce-view.js

    r63407 r63556  
    55/* global tinymce */
    66
    7 /*
     7/**
    88 * The TinyMCE view API.
    99 *
    … …  
    2626 * |- registered view
    2727 * |  |- ...
     28 *
     29 * @param {Window}       window    The global window object.
     30 * @param {Object}       wp        The WordPress global object.
     31 * @param {Object}       shortcode The shortcode API.
     32 * @param {JQueryStatic} $         The jQuery object.
    2833 */
    2934( function( window, wp, shortcode, $ ) {
    … …  
    616621                                iframeDoc.close();
    617622
     623                                /**
     624                                 * Resizes the iframe to fit its content.
     625                                 */
    618626                                function resize() {
    619627                                        var $iframe;
    … …  
    644652                                }
    645653
     654                                /**
     655                                 * Adds a MutationObserver to the iframe's body to watch for changes and resize accordingly.
     656                                 */
    646657                                function addObserver() {
    647658                                        observer = new MutationObserver( _.debounce( resize, 100 ) );
    … …  
    764775} )( window, window.wp, window.wp.shortcode, window.jQuery );
    765776
    766 /*
     777/**
    767778 * The WordPress core TinyMCE views.
     779 *
    768780 * Views for the gallery, audio, video, playlist and embed shortcodes,
    769781 * and a view for embeddable URLs.
     782 *
     783 * @param {Window}       window The global window object.
     784 * @param {Object}       views  The wp.mce.views object.
     785 * @param {Object}       media  The wp.media object.
     786 * @param {JQueryStatic} $      The jQuery object.
    770787 */
    771788( function( window, views, media, $ ) {
    … …  
    773790                schema, parser, serializer;
    774791
     792        /**
     793         * Verifies that a given string is valid HTML.
     794         *
     795         * @param {string} string The string to verify.
     796         * @return {string} The verified string.
     797         */
    775798        function verifyHTML( string ) {
    776799                var settings = {};
  • trunk/src/js/_enqueues/wp/theme-plugin-editor.js

    r63407 r63556  
    419419                editor.codemirror.on( 'change', component.onChange );
    420420
     421                /**
     422                 * Handles the save shortcut (Ctrl+S / Cmd+S).
     423                 */
    421424                function onSaveShortcut() {
    422425                        component.form.trigger( 'submit' );
    … …  
    602605                                _char = event.key;
    603606
     607                        /**
     608                         * Determines whether a character is a printable character.
     609                         *
     610                         * @param {string} str The character to check.
     611                         * @return {boolean} True if the character is printable, false otherwise.
     612                         */
    604613                        function isPrintableCharacter(str) {
    605614                                return str.length === 1 && str.match(/\S/);
    606615                        }
    607616
     617                        /**
     618                         * Handles printable character key press.
     619                         *
     620                         * @param {TreeitemLink} item The tree item link instance.
     621                         * @return {void}
     622                         */
    608623                        function printableCharacter(item) {
    609624                                if (_char == '*') {
    … …  
    809824
    810825                TreeLinks.prototype.init = function () {
    811 
     826                        /**
     827                         * Finds all treeitems and groups and creates object instances.
     828                         *
     829                         * @param {Element}              node  The DOM node to search for treeitems.
     830                         * @param {TreeLinks}            tree  The TreeLinks instance.
     831                         * @param {TreeitemLink|boolean} group The parent TreeitemLink instance or false if there is no parent.
     832                         * @return {void}
     833                         */
    812834                        function findTreeitems(node, tree, group) {
    813835
Note: See TracChangeset for help on using the changeset viewer.