From 9ed92faaca92f66ec9e2979c9d896ddab3e4e993 Mon Sep 17 00:00:00 2001 From: Jake Spurlock Date: Mon, 27 Jul 2020 23:33:51 +0000 Subject: [PATCH] Build/Test Tools: Enable JSDocs to be linted with ESLint. As part of the [Javascript Inline Docs Initiative](https://make.wordpress.org/core/handbook/docs/inline/js/) this add some tooling to lint Javascript docblocks. Two new commands: * `npm run lint:jsdoc` * `npm run lint:jsdoc:fix` The latter will run the linter and try to fix an possible issues automatically. Fixes #43828. Props netweb, atimmer, kamataryo, whyisjake. git-svn-id: https://develop.svn.wordpress.org/trunk@48650 602fd350-edb4-49c9-b593-d223f7449a82 --- .eslintignore | 15 ++ .eslintrc-jsdoc.js | 29 +++ package.json | 2 + src/js/_enqueues/admin/common.js | 4 +- src/js/_enqueues/admin/edit-comments.js | 2 +- src/js/_enqueues/admin/inline-edit-post.js | 2 +- src/js/_enqueues/admin/post.js | 8 +- src/js/_enqueues/admin/postbox.js | 4 +- src/js/_enqueues/admin/tags-suggest.js | 4 +- src/js/_enqueues/admin/widgets.js | 6 +- src/js/_enqueues/lib/admin-bar.js | 8 +- src/js/_enqueues/lib/comment-reply.js | 14 +- src/js/_enqueues/lib/image-edit.js | 28 +-- src/js/_enqueues/lib/lists.js | 14 +- src/js/_enqueues/lib/nav-menu.js | 4 +- src/js/_enqueues/wp/a11y.js | 6 +- src/js/_enqueues/wp/api.js | 26 +-- src/js/_enqueues/wp/code-editor.js | 20 +- src/js/_enqueues/wp/custom-header.js | 10 +- src/js/_enqueues/wp/customize/base.js | 20 +- src/js/_enqueues/wp/customize/controls.js | 184 +++++++++--------- src/js/_enqueues/wp/customize/nav-menus.js | 26 +-- .../wp/customize/preview-nav-menus.js | 14 +- src/js/_enqueues/wp/customize/preview.js | 12 +- .../wp/customize/selective-refresh.js | 20 +- src/js/_enqueues/wp/customize/widgets.js | 34 ++-- src/js/_enqueues/wp/editor/base.js | 14 +- src/js/_enqueues/wp/editor/dfw.js | 2 +- src/js/_enqueues/wp/mce-view.js | 50 ++--- src/js/_enqueues/wp/media/editor.js | 2 +- src/js/_enqueues/wp/media/models.js | 14 +- src/js/_enqueues/wp/media/views.js | 2 +- src/js/_enqueues/wp/theme-plugin-editor.js | 8 +- src/js/_enqueues/wp/theme.js | 4 +- src/js/_enqueues/wp/updates.js | 58 +++--- src/js/_enqueues/wp/util.js | 8 +- src/js/_enqueues/wp/utils/word-count.js | 8 +- src/js/_enqueues/wp/widgets/custom-html.js | 2 +- src/js/_enqueues/wp/widgets/media.js | 2 +- src/js/media/controllers/library.js | 4 +- src/js/media/controllers/region.js | 2 +- src/js/media/models/attachments.js | 16 +- src/js/media/models/query.js | 8 +- src/js/media/views/attachment.js | 2 +- src/js/media/views/focus-manager.js | 18 +- src/js/media/views/uploader/editor.js | 2 +- 46 files changed, 394 insertions(+), 348 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc-jsdoc.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..07f72581a9 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,15 @@ +# Files and folders related to build/test tools +/build +/node_modules +/tests +/vendor +/tools + +# Excluded files and folders based on `jsdoc.conf.json` exclusions +/src/js/_enqueues/vendor + +# Webpack built files +/src/wp-includes/js/media-* + +# Themes +src/wp-content/themes/ diff --git a/.eslintrc-jsdoc.js b/.eslintrc-jsdoc.js new file mode 100644 index 0000000000..6f7351ec08 --- /dev/null +++ b/.eslintrc-jsdoc.js @@ -0,0 +1,29 @@ +module.exports = { + rules: { + 'require-jsdoc': 'off', + 'valid-jsdoc': [ 'error', { + prefer: { + arg: 'param', + argument: 'param', + extends: 'augments', + returns: 'return', + }, + preferType: { + array: 'Array', + bool: 'boolean', + Boolean: 'boolean', + float: 'number', + Float: 'number', + int: 'number', + integer: 'number', + Integer: 'number', + Number: 'number', + object: 'Object', + String: 'string', + Void: 'void', + }, + requireParamDescription: false, + requireReturn: false, + } ], + }, +}; diff --git a/package.json b/package.json index 1599a821a3..b96707de3a 100644 --- a/package.json +++ b/package.json @@ -155,6 +155,8 @@ "test": "grunt test", "watch": "grunt watch", "grunt": "grunt", + "lint:jsdoc": "wp-scripts lint-js", + "lint:jsdoc:fix": "wp-scripts lint-js --fix", "env:start": "node ./tools/local-env/scripts/start.js", "env:stop": "node ./tools/local-env/scripts/docker.js down", "env:restart": "npm run env:stop && npm run env:start", diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js index 556c02ef7e..58f68d110f 100644 --- a/src/js/_enqueues/admin/common.js +++ b/src/js/_enqueues/admin/common.js @@ -137,7 +137,7 @@ window.columns = { * * @since 3.1.0 * - * @param {int} diff The modifier for the column span. + * @param {number} diff The modifier for the column span. */ colSpanChange : function(diff) { var $t = $('table').find('.colspanchange'), n; @@ -384,7 +384,7 @@ $permalinkStructure.on( 'focus', function( event ) { * If the structure is already used in the custom permalink structure, * it will be disabled. * - * @param {object} button Button jQuery object. + * @param {Object} button Button jQuery object. */ function changeStructureTagButtonState( button ) { if ( -1 !== $permalinkStructure.val().indexOf( button.text().trim() ) ) { diff --git a/src/js/_enqueues/admin/edit-comments.js b/src/js/_enqueues/admin/edit-comments.js index 5967262b25..5afe2f793f 100644 --- a/src/js/_enqueues/admin/edit-comments.js +++ b/src/js/_enqueues/admin/edit-comments.js @@ -159,7 +159,7 @@ var getCount, updateCount, updateCountText, updatePending, updateApproved, * * @since 5.2.0 * - * @param {object} response Ajax response from the server that includes a + * @param {Object} response Ajax response from the server that includes a * translated "comments in moderation" message. * * @return {void} diff --git a/src/js/_enqueues/admin/inline-edit-post.js b/src/js/_enqueues/admin/inline-edit-post.js index 5f3d2212e2..a6d334795d 100644 --- a/src/js/_enqueues/admin/inline-edit-post.js +++ b/src/js/_enqueues/admin/inline-edit-post.js @@ -389,7 +389,7 @@ window.wp = window.wp || {}; * * @since 2.7.0 * - * @param {int} id The ID for the post that has been changed. + * @param {number} id The ID for the post that has been changed. * @return {boolean} False, so the form does not submit when pressing * Enter on a focused field. */ diff --git a/src/js/_enqueues/admin/post.js b/src/js/_enqueues/admin/post.js index 0fc9a17d21..17445df17e 100644 --- a/src/js/_enqueues/admin/post.js +++ b/src/js/_enqueues/admin/post.js @@ -34,8 +34,8 @@ window.wp = window.wp || {}; * * @memberof commentsBox * - * @param {int} total Total number of comments for this post. - * @param {int} num Optional. Number of comments to fetch, defaults to 20. + * @param {number} total Total number of comments for this post. + * @param {number} num Optional. Number of comments to fetch, defaults to 20. * @return {boolean} Always returns false. */ get : function(total, num) { @@ -94,7 +94,7 @@ window.wp = window.wp || {}; * * @memberof commentsBox * - * @param {int} total Total number of comments to load. + * @param {number} total Total number of comments to load. */ load: function(total){ this.st = jQuery('#the-comment-list tr.comment:visible').length; @@ -116,7 +116,7 @@ window.wp = window.wp || {}; /** * Set the Image ID of the Featured Image * - * @param {int} id The post_id of the image to use as Featured Image. + * @param {number} id The post_id of the image to use as Featured Image. * * @global */ diff --git a/src/js/_enqueues/admin/postbox.js b/src/js/_enqueues/admin/postbox.js index b94cadaa3d..e67cc9946d 100644 --- a/src/js/_enqueues/admin/postbox.js +++ b/src/js/_enqueues/admin/postbox.js @@ -154,8 +154,8 @@ * @since 5.5.0 * * @param {string} position The "previous" or "next" sortables area. - * @param {object} button The jQuery object representing the button that was clicked. - * @param {object} postbox The jQuery object representing the postbox to be moved. + * @param {Object} button The jQuery object representing the button that was clicked. + * @param {Object} postbox The jQuery object representing the postbox to be moved. * * @return {void} */ diff --git a/src/js/_enqueues/admin/tags-suggest.js b/src/js/_enqueues/admin/tags-suggest.js index 81c2612c84..1aa28ffc8b 100644 --- a/src/js/_enqueues/admin/tags-suggest.js +++ b/src/js/_enqueues/admin/tags-suggest.js @@ -30,8 +30,8 @@ * * @since 4.7.0 * - * @param {object} options Options that are passed to UI Autocomplete. Can be used to override the default settings. - * @return {object} jQuery instance. + * @param {Object} options Options that are passed to UI Autocomplete. Can be used to override the default settings. + * @return {Object} jQuery instance. */ $.fn.wpTagsSuggest = function( options ) { var cache; diff --git a/src/js/_enqueues/admin/widgets.js b/src/js/_enqueues/admin/widgets.js index b53a7bdcf0..e0dac1f4db 100644 --- a/src/js/_enqueues/admin/widgets.js +++ b/src/js/_enqueues/admin/widgets.js @@ -234,7 +234,7 @@ window.wpWidgets = { * * @ignore * - * @param {object} event jQuery event object. + * @param {Object} event jQuery event object. */ over: function( event ) { var $wrap = $( event.target ).parent(); @@ -259,7 +259,7 @@ window.wpWidgets = { * * @ignore * - * @param {object} event jQuery event object. + * @param {Object} event jQuery event object. */ out: function( event ) { if ( wpWidgets.hoveredSidebar ) { @@ -729,7 +729,7 @@ window.wpWidgets = { * * Used when a Widget gets dragged in/out of the Sidebar and never dropped. * - * @param {object} event jQuery event object. + * @param {Object} event jQuery event object. */ closeSidebar: function( event ) { this.hoveredSidebar diff --git a/src/js/_enqueues/lib/admin-bar.js b/src/js/_enqueues/lib/admin-bar.js index ea69ae7efe..8cb94ea72f 100644 --- a/src/js/_enqueues/lib/admin-bar.js +++ b/src/js/_enqueues/lib/admin-bar.js @@ -294,8 +294,8 @@ * @since 5.3.1 * * @param {HTMLElement} element The HTML element. - * @param {String} className The class name. - * @return {bool} Whether the element has the className. + * @param {string} className The class name. + * @return {boolean} Whether the element has the className. */ function hasClass( element, className ) { var classNames; @@ -320,7 +320,7 @@ * @since 5.3.1 * * @param {HTMLElement} element The HTML element. - * @param {String} className The class name. + * @param {string} className The class name. */ function addClass( element, className ) { if ( ! element ) { @@ -344,7 +344,7 @@ * @since 5.3.1 * * @param {HTMLElement} element The HTML element. - * @param {String} className The class name. + * @param {string} className The class name. */ function removeClass( element, className ) { var testName, diff --git a/src/js/_enqueues/lib/comment-reply.js b/src/js/_enqueues/lib/comment-reply.js index f1b6c6599e..1f111230c9 100644 --- a/src/js/_enqueues/lib/comment-reply.js +++ b/src/js/_enqueues/lib/comment-reply.js @@ -265,9 +265,9 @@ window.addComment = ( function( window ) { * @since 5.1.0 * * @param {HTMLElement} Element DOM element with the attribute. - * @param {String} Attribute the attribute to get. + * @param {string} Attribute the attribute to get. * - * @return {String} + * @return {string} */ function getDataAttribute( element, attribute ) { if ( supportsDataset ) { @@ -298,11 +298,11 @@ window.addComment = ( function( window ) { * * @memberOf addComment * - * @param {String} addBelowId HTML ID of element the form follows. - * @param {String} commentId Database ID of comment being replied to. - * @param {String} respondId HTML ID of 'respond' element. - * @param {String} postId Database ID of the post. - * @param {String} replyTo Form heading content. + * @param {string} addBelowId HTML ID of element the form follows. + * @param {string} commentId Database ID of comment being replied to. + * @param {string} respondId HTML ID of 'respond' element. + * @param {string} postId Database ID of the post. + * @param {string} replyTo Form heading content. */ function moveForm( addBelowId, commentId, respondId, postId, replyTo ) { // Get elements based on their IDs. diff --git a/src/js/_enqueues/lib/image-edit.js b/src/js/_enqueues/lib/image-edit.js index cc9c8a67a6..639e7d63e8 100644 --- a/src/js/_enqueues/lib/image-edit.js +++ b/src/js/_enqueues/lib/image-edit.js @@ -73,7 +73,7 @@ * @memberof imageEdit * * @param {jQuery} el The element that should be modified. - * @param {bool|number} s The state for the element. If set to true + * @param {boolean|number} s The state for the element. If set to true * the element is disabled, * otherwise the element is enabled. * The function is sometimes called with a 0 or 1 @@ -577,7 +577,7 @@ * * @param {number} postid The post ID for the image. * @param {string} nonce The nonce to verify the request. - * @param {object} view The image editor view to be used for the editing. + * @param {Object} view The image editor view to be used for the editing. * * @return {void|promise} Either returns void if the button was already activated * or returns an instance of the image editor, wrapped in a promise. @@ -774,10 +774,10 @@ * * @ignore * - * @param {object} img jQuery object representing the image. - * @param {object} c The selection. + * @param {Object} img jQuery object representing the image. + * @param {Object} c The selection. * - * @return {object} + * @return {Object} */ onSelectEnd: function(img, c) { imageEdit.setCropSelection(postid, c); @@ -788,8 +788,8 @@ * * @ignore * - * @param {object} img jQuery object representing the image. - * @param {object} c The selection. + * @param {Object} img jQuery object representing the image. + * @param {Object} c The selection. * * @return {void} */ @@ -809,7 +809,7 @@ * @memberof imageEdit * * @param {number} postid The post ID. - * @param {object} c The selection. + * @param {Object} c The selection. * * @return {boolean} */ @@ -841,9 +841,9 @@ * @memberof imageEdit * * @param {number} postid The post ID. - * @param {bool} warn Warning message. + * @param {boolean} warn Warning message. * - * @return {void|bool} Returns false if there is a warning. + * @return {void|boolean} Returns false if there is a warning. */ close : function(postid, warn) { warn = warn || false; @@ -908,7 +908,7 @@ * * @memberof imageEdit * - * @param {object} op The original position. + * @param {Object} op The original position. * @param {number} postid The post ID. * @param {string} nonce The nonce. * @@ -945,7 +945,7 @@ * @param {string} angle The angle the image is rotated with. * @param {number} postid The post ID. * @param {string} nonce The nonce. - * @param {object} t The target element. + * @param {Object} t The target element. * * @return {boolean} */ @@ -967,7 +967,7 @@ * @param {number} axis The axle the image is flipped on. * @param {number} postid The post ID. * @param {string} nonce The nonce. - * @param {object} t The target element. + * @param {Object} t The target element. * * @return {boolean} */ @@ -988,7 +988,7 @@ * * @param {number} postid The post ID. * @param {string} nonce The nonce. - * @param {object} t The target object. + * @param {Object} t The target object. * * @return {void|boolean} Returns false if the crop button is disabled. */ diff --git a/src/js/_enqueues/lib/lists.js b/src/js/_enqueues/lib/lists.js index d24f2c1efd..1ca1b751b6 100644 --- a/src/js/_enqueues/lib/lists.js +++ b/src/js/_enqueues/lib/lists.js @@ -202,7 +202,7 @@ wpList = { * 6. 0 if none can be found. * * @param {jQuery} element Element that triggered the request. - * @param {object} settings Settings for the Ajax request. + * @param {Object} settings Settings for the Ajax request. * @return {string|number} Nonce */ nonce: function( element, settings ) { @@ -258,9 +258,9 @@ wpList = { * Calls a confirm callback to verify the action that is about to be performed. * * @param {HTMLElement} list The DOM element. - * @param {object} settings Settings for this list. + * @param {Object} settings Settings for this list. * @param {string} action The type of action to perform: 'add', 'delete', or 'dim'. - * @return {object|boolean} Settings if confirmed, false if not. + * @return {Object|boolean} Settings if confirmed, false if not. */ pre: function( list, settings, action ) { var $element, backgroundColor, confirmed; @@ -297,7 +297,7 @@ wpList = { * Adds an item to the list via Ajax. * * @param {HTMLElement} element The DOM element. - * @param {object} settings Settings for this list. + * @param {Object} settings Settings for this list. * @return {boolean} Whether the item was added. */ ajaxAdd: function( element, settings ) { @@ -399,7 +399,7 @@ wpList = { * Delete an item in the list via Ajax. * * @param {HTMLElement} element A DOM element containing item data. - * @param {object} settings Settings for this list. + * @param {Object} settings Settings for this list. * @return {boolean} Whether the item was deleted. */ ajaxDel: function( element, settings ) { @@ -486,7 +486,7 @@ wpList = { * Dim an item in the list via Ajax. * * @param {HTMLElement} element A DOM element containing item data. - * @param {object} settings Settings for this list. + * @param {Object} settings Settings for this list. * @return {boolean} Whether the item was dim'ed. */ ajaxDim: function( element, settings ) { @@ -621,7 +621,7 @@ wpList = { * Adds something. * * @param {HTMLElement} element A DOM element containing item data. - * @param {object} settings Settings for this list. + * @param {Object} settings Settings for this list. * @return {boolean} Whether the item was added. */ add: function( element, settings ) { diff --git a/src/js/_enqueues/lib/nav-menu.js b/src/js/_enqueues/lib/nav-menu.js index 3371606933..f6752916d5 100644 --- a/src/js/_enqueues/lib/nav-menu.js +++ b/src/js/_enqueues/lib/nav-menu.js @@ -429,7 +429,7 @@ * Refreshes advanced accessibility buttons for one menu item. * Shows or hides buttons based on the location of the menu item. * - * @param {object} itemToRefresh The menu item that might need its advanced accessibility buttons refreshed + * @param {Object} itemToRefresh The menu item that might need its advanced accessibility buttons refreshed */ refreshAdvancedAccessibilityOfItem : function( itemToRefresh ) { @@ -1293,7 +1293,7 @@ /** * Remove a menu item. * - * @param {object} el The element to be removed as a jQuery object. + * @param {Object} el The element to be removed as a jQuery object. * * @fires document#menu-removing-item Passes the element to be removed. */ diff --git a/src/js/_enqueues/wp/a11y.js b/src/js/_enqueues/wp/a11y.js index 3869dd3c3d..a4a045528a 100644 --- a/src/js/_enqueues/wp/a11y.js +++ b/src/js/_enqueues/wp/a11y.js @@ -18,8 +18,8 @@ window.wp = window.wp || {}; * @since 4.2.0 * @since 4.3.0 Introduced the 'ariaLive' argument. * - * @param {String} message The message to be announced by Assistive Technologies. - * @param {String} [ariaLive] The politeness level for aria-live. Possible values: + * @param {string} message The message to be announced by Assistive Technologies. + * @param {string} [ariaLive] The politeness level for aria-live. Possible values: * polite or assertive. Default polite. * @return {void} */ @@ -53,7 +53,7 @@ window.wp = window.wp || {}; * * @since 4.3.0 * - * @param {String} ariaLive Optional. Value for the 'aria-live' attribute, default 'polite'. + * @param {string} ariaLive Optional. Value for the 'aria-live' attribute, default 'polite'. * * @return {Object} $container The ARIA live region jQuery object. */ diff --git a/src/js/_enqueues/wp/api.js b/src/js/_enqueues/wp/api.js index f92218a621..6484e9d2b6 100644 --- a/src/js/_enqueues/wp/api.js +++ b/src/js/_enqueues/wp/api.js @@ -186,7 +186,7 @@ * Extract a route part based on negative index. * * @param {string} route The endpoint route. - * @param {int} part The number of parts from the end of the route to retrieve. Default 1. + * @param {number} part The number of parts from the end of the route to retrieve. Default 1. * Example route `/a/b/c`: part 1 is `c`, part 2 is `b`, part 3 is `a`. * @param {string} [versionString] Version string, defaults to `wp.api.versionString`. * @param {boolean} [reverse] Whether to reverse the order when extracting the route part. Optional, default false. @@ -234,7 +234,7 @@ /** * Add args and options to a model prototype from a route's endpoints. * - * @param {array} routeEndpoints Array of route endpoints. + * @param {Array} routeEndpoints Array of route endpoints. * @param {Object} modelInstance An instance of the model (or collection) * to add the args to. */ @@ -361,7 +361,7 @@ * Build a helper function to retrieve related model. * * @param {string} parentModel The parent model. - * @param {int} modelId The model ID if the object to request + * @param {number} modelId The model ID if the object to request * @param {string} modelName The model name to use when constructing the model. * @param {string} embedSourcePoint Where to check the embedds object for _embed data. * @param {string} embedCheckField Which model field to check to see if the model has data. @@ -513,7 +513,7 @@ * * @param {string} key The meta key. * - * @return {object} The post meta value. + * @return {Object} The post meta value. */ getMeta: function( key ) { var metas = this.get( 'meta' ); @@ -523,7 +523,7 @@ /** * Get all meta key/values for a post. * - * @return {object} The post metas, as a key value pair object. + * @return {Object} The post metas, as a key value pair object. */ getMetas: function() { return this.get( 'meta' ); @@ -532,7 +532,7 @@ /** * Set a group of meta key/values for a post. * - * @param {object} meta The post meta to set, as key/value pairs. + * @param {Object} meta The post meta to set, as key/value pairs. */ setMetas: function( meta ) { var metas = this.get( 'meta' ); @@ -544,7 +544,7 @@ * Set a single meta value for a post, by key. * * @param {string} key The meta key. - * @param {object} value The meta value. + * @param {Object} value The meta value. */ setMeta: function( key, value ) { var metas = this.get( 'meta' ); @@ -589,7 +589,7 @@ * * Accepts an array of tag slugs, or a Tags collection. * - * @param {array|Backbone.Collection} tags The tags to set on the post. + * @param {Array|Backbone.Collection} tags The tags to set on the post. * */ setTags: function( tags ) { @@ -635,7 +635,7 @@ * * Accepts a Tags collection. * - * @param {array|Backbone.Collection} tags The tags to set on the post. + * @param {Array|Backbone.Collection} tags The tags to set on the post. * */ setTagsWithCollection: function( tags ) { @@ -673,7 +673,7 @@ * * Accepts an array of category slugs, or a Categories collection. * - * @param {array|Backbone.Collection} categories The categories to set on the post. + * @param {Array|Backbone.Collection} categories The categories to set on the post. * */ setCategories: function( categories ) { @@ -720,7 +720,7 @@ * * Accepts Categories collection. * - * @param {array|Backbone.Collection} categories The categories to set on the post. + * @param {Array|Backbone.Collection} categories The categories to set on the post. * */ setCategoriesWithCollection: function( categories ) { @@ -1495,11 +1495,11 @@ /** * Initialize the wp-api, optionally passing the API root. * - * @param {object} [args] + * @param {Object} [args] * @param {string} [args.nonce] The nonce. Optional, defaults to wpApiSettings.nonce. * @param {string} [args.apiRoot] The api root. Optional, defaults to wpApiSettings.root. * @param {string} [args.versionString] The version string. Optional, defaults to wpApiSettings.root. - * @param {object} [args.schema] The schema. Optional, will be fetched from API if not provided. + * @param {Object} [args.schema] The schema. Optional, will be fetched from API if not provided. */ wp.api.init = function( args ) { var endpoint, attributes = {}, deferred, promise; diff --git a/src/js/_enqueues/wp/code-editor.js b/src/js/_enqueues/wp/code-editor.js index dd0feca956..68365d7d1c 100644 --- a/src/js/_enqueues/wp/code-editor.js +++ b/src/js/_enqueues/wp/code-editor.js @@ -39,8 +39,8 @@ if ( 'undefined' === typeof window.wp.codeEditor ) { * Configure linting. * * @param {CodeMirror} editor - Editor. - * @param {object} settings - Code editor settings. - * @param {object} settings.codeMirror - Settings for CodeMirror. + * @param {Object} settings - Code editor settings. + * @param {Object} settings.codeMirror - Settings for CodeMirror. * @param {Function} settings.onChangeLintingErrors - Callback for when there are changes to linting errors. * @param {Function} settings.onUpdateErrorNotice - Callback to update error notice. * @@ -64,7 +64,7 @@ if ( 'undefined' === typeof window.wp.codeEditor ) { /** * Get lint options. * - * @return {object} Lint options. + * @return {Object} Lint options. */ function getLintOptions() { // eslint-disable-line complexity var options = editor.getOption( 'lint' ); @@ -213,8 +213,8 @@ if ( 'undefined' === typeof window.wp.codeEditor ) { * Configure tabbing. * * @param {CodeMirror} codemirror - Editor. - * @param {object} settings - Code editor settings. - * @param {object} settings.codeMirror - Settings for CodeMirror. + * @param {Object} settings - Code editor settings. + * @param {Object} settings.codeMirror - Settings for CodeMirror. * @param {Function} settings.onTabNext - Callback to handle tabbing to the next tabbable element. * @param {Function} settings.onTabPrevious - Callback to handle tabbing to the previous tabbable element. * @@ -267,15 +267,15 @@ if ( 'undefined' === typeof window.wp.codeEditor ) { * @since 4.9.0 * * @param {string|jQuery|Element} textarea - The HTML id, jQuery object, or DOM Element for the textarea that is used for the editor. - * @param {object} [settings] - Settings to override defaults. + * @param {Object} [settings] - Settings to override defaults. * @param {Function} [settings.onChangeLintingErrors] - Callback for when the linting errors have changed. * @param {Function} [settings.onUpdateErrorNotice] - Callback for when error notice should be displayed. * @param {Function} [settings.onTabPrevious] - Callback to handle tabbing to the previous tabbable element. * @param {Function} [settings.onTabNext] - Callback to handle tabbing to the next tabbable element. - * @param {object} [settings.codemirror] - Options for CodeMirror. - * @param {object} [settings.csslint] - Rules for CSSLint. - * @param {object} [settings.htmlhint] - Rules for HTMLHint. - * @param {object} [settings.jshint] - Rules for JSHint. + * @param {Object} [settings.codemirror] - Options for CodeMirror. + * @param {Object} [settings.csslint] - Rules for CSSLint. + * @param {Object} [settings.htmlhint] - Rules for HTMLHint. + * @param {Object} [settings.jshint] - Rules for JSHint. * * @return {CodeEditorInstance} Instance. */ diff --git a/src/js/_enqueues/wp/custom-header.js b/src/js/_enqueues/wp/custom-header.js index 1f2c56f96e..5a446727fa 100644 --- a/src/js/_enqueues/wp/custom-header.js +++ b/src/js/_enqueues/wp/custom-header.js @@ -108,7 +108,7 @@ /** * Initialize the video handler. * - * @param {object} settings Video settings. + * @param {Object} settings Video settings. */ initialize: function( settings ) { var handler = this, @@ -217,7 +217,7 @@ * Whether the handler can process a video. * * @abstract - * @param {object} settings Video settings. + * @param {Object} settings Video settings. * @return {boolean} */ test: function() { @@ -239,7 +239,7 @@ * * @memberOf wp * - * @param {object} protoProps Properties to apply to the prototype. + * @param {Object} protoProps Properties to apply to the prototype. * @return CustomHandler The subclass. */ BaseHandler.extend = function( protoProps ) { @@ -271,7 +271,7 @@ /** * Whether the native handler supports a video. * - * @param {object} settings Video settings. + * @param {Object} settings Video settings. * @return {boolean} */ test: function( settings ) { @@ -345,7 +345,7 @@ /** * Whether the handler supports a video. * - * @param {object} settings Video settings. + * @param {Object} settings Video settings. * @return {boolean} */ test: function( settings ) { diff --git a/src/js/_enqueues/wp/customize/base.js b/src/js/_enqueues/wp/customize/base.js index 20117d4c25..8fd247052c 100644 --- a/src/js/_enqueues/wp/customize/base.js +++ b/src/js/_enqueues/wp/customize/base.js @@ -188,7 +188,7 @@ window.wp = window.wp || {}; api.Value = api.Class.extend(/** @lends wp.customize.Value.prototype */{ /** * @param {mixed} initial The initial value. - * @param {object} options + * @param {Object} options */ initialize: function( initial, options ) { this._value = initial; // @todo Potentially change this to a this.set() call. @@ -220,7 +220,7 @@ window.wp = window.wp || {}; /** * Set the value and trigger all bound callbacks. * - * @param {object} to New value. + * @param {Object} to New value. */ set: function( to ) { var from = this._value; @@ -382,7 +382,7 @@ window.wp = window.wp || {}; * Whether the collection has an item with the given ID. * * @param {string} id The ID of the item to look for. - * @return {Boolean} + * @return {boolean} */ has: function( id ) { return typeof this._value[ id ] !== 'undefined'; @@ -447,7 +447,7 @@ window.wp = window.wp || {}; * Iterate over all items in the collection invoking the provided callback. * * @param {Function} callback Function to invoke. - * @param {object} context Object context to invoke the function with. Optional. + * @param {Object} context Object context to invoke the function with. Optional. */ each: function( callback, context ) { context = typeof context === 'undefined' ? this : context; @@ -682,11 +682,11 @@ window.wp = window.wp || {}; /** * Initialize Messenger. * - * @param {object} params - Parameters to configure the messenger. + * @param {Object} params - Parameters to configure the messenger. * {string} params.url - The URL to communicate with. * {window} params.targetWindow - The window instance to communicate with. Default window.parent. * {string} params.channel - If provided, will send the channel with each message and only accept messages a matching channel. - * @param {object} options - Extend any instance parameter or method with this object. + * @param {Object} options - Extend any instance parameter or method with this object. */ initialize: function( params, options ) { // Target the parent frame by default, but only if a parent frame exists. @@ -787,7 +787,7 @@ window.wp = window.wp || {}; * Send data to the other window. * * @param {string} id The event name. - * @param {object} data Data. + * @param {Object} data Data. */ send: function( id, data ) { var message; @@ -862,7 +862,7 @@ window.wp = window.wp || {}; * @since 4.9.0 * * @param {string} code - Notification code. - * @param {object} params - Notification parameters. + * @param {Object} params - Notification parameters. * @param {string} params.message - Message. * @param {string} [params.type=error] - Type. * @param {string} [params.setting] - Related setting ID. @@ -934,7 +934,7 @@ window.wp = window.wp || {}; * * @alias wp.customize.get * - * @return {object} + * @return {Object} */ api.get = function() { var result = {}; @@ -962,7 +962,7 @@ window.wp = window.wp || {}; * @alias wp.customize.utils.parseQueryString * * @param {string} queryString Query string. - * @return {object} Parsed query string. + * @return {Object} Parsed query string. */ api.utils.parseQueryString = function parseQueryString( queryString ) { var queryParams = {}; diff --git a/src/js/_enqueues/wp/customize/controls.js b/src/js/_enqueues/wp/customize/controls.js index f2866e5011..57d972c213 100644 --- a/src/js/_enqueues/wp/customize/controls.js +++ b/src/js/_enqueues/wp/customize/controls.js @@ -25,7 +25,7 @@ * @since 4.9.0 * * @param {string} code - Code. - * @param {object} params - Params. + * @param {Object} params - Params. */ initialize: function( code, params ) { var notification = this; @@ -94,7 +94,7 @@ * @constructs wp.customize.Notifications * @augments wp.customize.Values * - * @param {object} options - Options. + * @param {Object} options - Options. * @param {jQuery} [options.container] - Container element for notifications. This can be injected later. * @param {boolean} [options.alt] - Whether alternative style should be used when rendering notifications. * @@ -174,7 +174,7 @@ * Notifications may be sorted by type followed by added time. * * @since 4.9.0 - * @param {object} args - Args. + * @param {Object} args - Args. * @param {boolean} [args.sort=false] - Whether to return the notifications sorted. * @return {Array.} Notifications. */ @@ -362,10 +362,10 @@ * * @param {string} id - The setting ID. * @param {*} value - The initial value of the setting. - * @param {object} [options={}] - Options. + * @param {Object} [options={}] - Options. * @param {string} [options.transport=refresh] - The transport to use for previewing. Supports 'refresh' and 'postMessage'. * @param {boolean} [options.dirty=false] - Whether the setting should be considered initially dirty. - * @param {object} [options.previewer] - The Previewer instance to sync with. Defaults to wp.customize.previewer. + * @param {Object} [options.previewer] - The Previewer instance to sync with. Defaults to wp.customize.previewer. */ initialize: function( id, value, options ) { var setting = this, params; @@ -495,9 +495,9 @@ * @since 4.7.0 * @access public * - * @param {object} [options] Options. + * @param {Object} [options] Options. * @param {boolean} [options.unsaved=false] Whether only values not saved yet into a changeset will be returned (differential changes). - * @return {object} Dirty setting values. + * @return {Object} Dirty setting values. */ api.dirtyValues = function dirtyValues( options ) { var values = {}; @@ -528,9 +528,9 @@ * @since 4.7.0 * @access public * - * @param {object} [changes] - Mapping of setting IDs to setting params each normally including a value property, or mapping to null. + * @param {Object} [changes] - Mapping of setting IDs to setting params each normally including a value property, or mapping to null. * If not provided, then the changes will still be obtained from unsaved dirty settings. - * @param {object} [args] - Additional options for the save request. + * @param {Object} [args] - Additional options for the save request. * @param {boolean} [args.autosave=false] - Whether changes will be stored in autosave revision if the changeset has been promoted from an auto-draft. * @param {boolean} [args.force=false] - Send request to update even when there are no changes to submit. This can be used to request the latest status of the changeset on the server. * @param {string} [args.title] - Title to update in the changeset. Optional. @@ -736,7 +736,7 @@ * * @param {(wp.customize.Panel|wp.customize.Section|wp.customize.Control)} a * @param {(wp.customize.Panel|wp.customize.Section|wp.customize.Control)} b - * @return {Number} + * @return {number} */ api.utils.prioritySort = function ( a, b ) { if ( a.priority() === b.priority() && typeof a.params.instanceNumber === 'number' && typeof b.params.instanceNumber === 'number' ) { @@ -796,7 +796,7 @@ * @since 4.9.0 * * @param {jQuery} button - The element to highlight. - * @param {object} [options] - Options. + * @param {Object} [options] - Options. * @param {number} [options.delay=0] - Delay in milliseconds. * @param {jQuery} [options.focusTarget] - A target for user focus that defaults to the highlighted element. * If the user focuses the target before the delay passes, the reminder @@ -850,7 +850,7 @@ * * @since 4.9.0 * - * @return {int} Current timestamp. + * @return {number} Current timestamp. */ api.utils.getCurrentTimestamp = function getCurrentTimestamp() { var currentDate, currentClientTimestamp, timestampDifferential; @@ -869,8 +869,8 @@ * * @since 4.9.0 * - * @param {string|int|Date} datetime - Date time or timestamp of the future date. - * @return {int} remainingTime - Remaining time in milliseconds. + * @param {string|number|Date} datetime - Date time or timestamp of the future date. + * @return {number} remainingTime - Remaining time in milliseconds. */ api.utils.getRemainingTime = function getRemainingTime( datetime ) { var millisecondsDivider = 1000, remainingTime, timestamp; @@ -940,7 +940,7 @@ * @borrows wp.customize~focus as focus * * @param {string} id - The ID for the container. - * @param {object} options - Object containing one property: params. + * @param {Object} options - Object containing one property: params. * @param {string} options.title - Title shown when panel is collapsed and expanded. * @param {string} [options.description] - Description shown at the top of the panel. * @param {number} [options.priority=100] - The sort priority for the panel. @@ -948,7 +948,7 @@ * @param {string} [options.type=default] - The type of the panel. See wp.customize.panelConstructor. * @param {string} [options.content] - The markup to be used for the panel container. If empty, a JS template is used. * @param {boolean} [options.active=true] - Whether the panel is active or not. - * @param {object} [options.params] - Deprecated wrapper for the above properties. + * @param {Object} [options.params] - Deprecated wrapper for the above properties. */ initialize: function ( id, options ) { var container = this; @@ -1055,8 +1055,8 @@ * * @since 4.1.0 * - * @param {String} parentType - * @param {String} childType + * @param {string} parentType + * @param {string} childType * @return {Array} */ _children: function ( parentType, childType ) { @@ -1154,9 +1154,9 @@ /** * @since 4.1.0 * - * @param {Boolean} active + * @param {boolean} active * @param {Object} [params] - * @return {Boolean} False if state already applied. + * @return {boolean} False if state already applied. */ _toggleActive: function ( active, params ) { var self = this; @@ -1175,7 +1175,7 @@ /** * @param {Object} [params] - * @return {Boolean} False if already active. + * @return {boolean} False if already active. */ activate: function ( params ) { return this._toggleActive( true, params ); @@ -1183,7 +1183,7 @@ /** * @param {Object} [params] - * @return {Boolean} False if already inactive. + * @return {boolean} False if already inactive. */ deactivate: function ( params ) { return this._toggleActive( false, params ); @@ -1200,10 +1200,10 @@ /** * Handle the toggle logic for expand/collapse. * - * @param {Boolean} expanded - The new state to apply. + * @param {boolean} expanded - The new state to apply. * @param {Object} [params] - Object containing options for expand/collapse. * @param {Function} [params.completeCallback] - Function to call when expansion/collapse is complete. - * @return {Boolean} False if state already applied or active state is false. + * @return {boolean} False if state already applied or active state is false. */ _toggleExpanded: function( expanded, params ) { var instance = this, previousCompleteCallback; @@ -1240,7 +1240,7 @@ /** * @param {Object} [params] - * @return {Boolean} False if already expanded or if inactive. + * @return {boolean} False if already expanded or if inactive. */ expand: function ( params ) { return this._toggleExpanded( true, params ); @@ -1248,7 +1248,7 @@ /** * @param {Object} [params] - * @return {Boolean} False if already collapsed. + * @return {boolean} False if already collapsed. */ collapse: function ( params ) { return this._toggleExpanded( false, params ); @@ -1409,7 +1409,7 @@ * @since 4.1.0 * * @param {string} id - The ID for the section. - * @param {object} options - Options. + * @param {Object} options - Options. * @param {string} options.title - Title shown when section is collapsed and expanded. * @param {string} [options.description] - Description shown at the top of the section. * @param {number} [options.priority=100] - The sort priority for the section. @@ -1418,7 +1418,7 @@ * @param {boolean} [options.active=true] - Whether the section is active or not. * @param {string} options.panel - The ID for the panel this section is associated with. * @param {string} [options.customizeAction] - Additional context information shown before the section title when expanded. - * @param {object} [options.params] - Deprecated wrapper for the above properties. + * @param {Object} [options.params] - Deprecated wrapper for the above properties. */ initialize: function ( id, options ) { var section = this, params; @@ -1545,7 +1545,7 @@ * * @since 4.1.0 * - * @return {Boolean} + * @return {boolean} */ isContextuallyActive: function () { var section = this, @@ -1575,7 +1575,7 @@ * * @since 4.1.0 * - * @param {Boolean} expanded + * @param {boolean} expanded * @param {Object} args */ onChangeExpanded: function ( expanded, args ) { @@ -1697,7 +1697,7 @@ * @since 4.9.0 * * @param {string} id - ID. - * @param {object} options - Options. + * @param {Object} options - Options. * @return {void} */ initialize: function( id, options ) { @@ -1799,7 +1799,7 @@ * * @since 4.2.0 * - * @return {Boolean} + * @return {boolean} */ isContextuallyActive: function () { return this.active(); @@ -1951,9 +1951,9 @@ * * @since 4.2.0 * - * @param {Boolean} expanded + * @param {boolean} expanded * @param {Object} args - * @param {Boolean} args.unchanged + * @param {boolean} args.unchanged * @param {Function} args.completeCallback * @return {void} */ @@ -2167,7 +2167,7 @@ * * @since 4.9.0 * @param {Array} themes - Array of theme data to create controls with. - * @param {integer} page - Page of results being loaded. + * @param {number} page - Page of results being loaded. * @return {void} */ loadControls: function( themes, page ) { @@ -2412,7 +2412,7 @@ * * @since 4.9.0 * - * @return {int} Visible count. + * @return {number} Visible count. */ getVisibleCount: function() { return this.contentContainer.find( 'li.customize-control:visible' ).length; @@ -2559,7 +2559,7 @@ * * @since 4.2.0 * - * @param {object} theme - Theme. + * @param {Object} theme - Theme. * @param {Function} [callback] - Callback once the details have been shown. * @return {void} */ @@ -2667,7 +2667,7 @@ * * @since 4.9.0 * - * @param {Boolean} expanded - The expanded state to transition to. + * @param {boolean} expanded - The expanded state to transition to. * @param {Object} [args] - Args. * @param {boolean} [args.unchanged] - Whether the state is already known to not be changed, and so short-circuit with calling completeCallback early. * @param {Function} [args.completeCallback] - Function to call when the slideUp/slideDown has completed. @@ -2762,14 +2762,14 @@ * @since 4.1.0 * * @param {string} id - The ID for the panel. - * @param {object} options - Object containing one property: params. + * @param {Object} options - Object containing one property: params. * @param {string} options.title - Title shown when panel is collapsed and expanded. * @param {string} [options.description] - Description shown at the top of the panel. * @param {number} [options.priority=100] - The sort priority for the panel. * @param {string} [options.type=default] - The type of the panel. See wp.customize.panelConstructor. * @param {string} [options.content] - The markup to be used for the panel container. If empty, a JS template is used. * @param {boolean} [options.active=true] - Whether the panel is active or not. - * @param {object} [options.params] - Deprecated wrapper for the above properties. + * @param {Object} [options.params] - Deprecated wrapper for the above properties. */ initialize: function ( id, options ) { var panel = this, params; @@ -2905,9 +2905,9 @@ * * @since 4.1.0 * - * @param {Boolean} expanded + * @param {boolean} expanded * @param {Object} args - * @param {Boolean} args.unchanged + * @param {boolean} args.unchanged * @param {Function} args.completeCallback * @return {void} */ @@ -3036,7 +3036,7 @@ * @since 4.9.0 * * @param {string} id - The ID for the panel. - * @param {object} options - Options. + * @param {Object} options - Options. * @return {void} */ initialize: function( id, options ) { @@ -3133,9 +3133,9 @@ * * @since 4.9.0 * - * @param {Boolean} expanded - Expanded state. + * @param {boolean} expanded - Expanded state. * @param {Object} args - Args. - * @param {Boolean} args.unchanged - Whether or not the state changed. + * @param {boolean} args.unchanged - Whether or not the state changed. * @param {Function} args.completeCallback - Callback to execute when the animation completes. * @return {void} */ @@ -3482,8 +3482,8 @@ * @borrows wp.customize~Container#_toggleActive as this#_toggleActive * * @param {string} id - Unique identifier for the control instance. - * @param {object} options - Options hash for the control instance. - * @param {object} options.type - Type of control (e.g. text, radio, dropdown-pages, etc.) + * @param {Object} options - Options hash for the control instance. + * @param {Object} options.type - Type of control (e.g. text, radio, dropdown-pages, etc.) * @param {string} [options.content] - The HTML content for the control or at least its container. This should normally be left blank and instead supplying a templateId. * @param {string} [options.templateId] - Template ID for control's content. * @param {string} [options.priority=10] - Order of priority to show the control within the section. @@ -3496,7 +3496,7 @@ * @param {string} options.label - Label. * @param {string} options.description - Description. * @param {number} [options.instanceNumber] - Order in which this instance was created in relation to other instances. - * @param {object} [options.params] - Deprecated wrapper for the above properties. + * @param {Object} [options.params] - Deprecated wrapper for the above properties. * @return {void} */ initialize: function( id, options ) { @@ -3900,9 +3900,9 @@ * * @since 4.1.0 * - * @param {Boolean} active + * @param {boolean} active * @param {Object} args - * @param {Number} args.duration + * @param {number} args.duration * @param {Function} args.completeCallback */ onChangeActive: function ( active, args ) { @@ -4355,7 +4355,7 @@ /** * Called when the "Remove" link is clicked. Empties the setting. * - * @param {object} event jQuery Event object + * @param {Object} event jQuery Event object */ removeFile: function( event ) { if ( api.utils.isKeydownButNotEnterEvent( event ) ) { @@ -4565,7 +4565,7 @@ /** * After the image has been cropped, apply the cropped image data to the setting. * - * @param {object} croppedImage Cropped attachment data. + * @param {Object} croppedImage Cropped attachment data. */ onCropped: function( croppedImage ) { this.setImageFromAttachment( croppedImage ); @@ -4641,13 +4641,13 @@ /** * Return whether the image must be cropped, based on required dimensions. * - * @param {bool} flexW - * @param {bool} flexH - * @param {int} dstW - * @param {int} dstH - * @param {int} imgW - * @param {int} imgH - * @return {bool} + * @param {boolean} flexW + * @param {boolean} flexH + * @param {number} dstW + * @param {number} dstH + * @param {number} imgW + * @param {number} imgH + * @return {boolean} */ mustBeCropped: function( flexW, flexH, dstW, dstH, imgW, imgH ) { if ( true === flexW && true === flexH ) { @@ -4684,7 +4684,7 @@ /** * Updates the setting and re-renders the control UI. * - * @param {object} attachment + * @param {Object} attachment */ setImageFromAttachment: function( attachment ) { this.params.attachment = attachment; @@ -4770,7 +4770,7 @@ /** * Updates the setting and re-renders the control UI. * - * @param {object} attachment + * @param {Object} attachment */ setImageFromAttachment: function( attachment ) { var sizes = [ 'site_icon-32', 'thumbnail', 'full' ], link, @@ -4799,7 +4799,7 @@ /** * Called when the "Remove" link is clicked. Empties the setting. * - * @param {object} event jQuery Event object + * @param {Object} event jQuery Event object */ removeFile: function( event ) { if ( api.utils.isKeydownButNotEnterEvent( event ) ) { @@ -5009,7 +5009,7 @@ /** * After the image has been cropped, apply the cropped image data to the setting. * - * @param {object} croppedImage Cropped attachment data. + * @param {Object} croppedImage Cropped attachment data. */ onCropped: function(croppedImage) { var url = croppedImage.url, @@ -5022,7 +5022,7 @@ /** * If cropping was skipped, apply the image data directly to the setting. * - * @param {object} selection + * @param {Object} selection */ onSkippedCrop: function(selection) { var url = selection.get('url'), @@ -5036,10 +5036,10 @@ * header image data and inserts it into the user-uploaded headers * collection. * - * @param {String} url - * @param {Number} attachmentId - * @param {Number} width - * @param {Number} height + * @param {string} url + * @param {number} attachmentId + * @param {number} width + * @param {number} height */ setImageFromURL: function(url, attachmentId, width, height) { var choice, data = {}; @@ -5245,7 +5245,7 @@ * * @since 4.9.0 * @param {string} id - Unique identifier for the control instance. - * @param {object} options - Options hash for the control instance. + * @param {Object} options - Options hash for the control instance. * @return {void} */ initialize: function( id, options ) { @@ -5384,7 +5384,7 @@ * Initialize syntax-highlighting editor. * * @since 4.9.0 - * @param {object} codeEditorSettings - Code editor settings. + * @param {Object} codeEditorSettings - Code editor settings. * @return {void} */ initSyntaxHighlightingEditor: function( codeEditorSettings ) { @@ -5626,7 +5626,7 @@ * @since 4.9.0 * * @param {string} datetime - Date/Time string. Accepts Y-m-d[ H:i[:s]] format. - * @return {object|null} Returns object containing date components or null if parse error. + * @return {Object|null} Returns object containing date components or null if parse error. */ parseDateTime: function parseDateTime( datetime ) { var control = this, matches, date, midDayHour = 12; @@ -6218,10 +6218,10 @@ * @constructs wp.customize.PreviewFrame * @augments wp.customize.Messenger * - * @param {object} params.container - * @param {object} params.previewUrl - * @param {object} params.query - * @param {object} options + * @param {Object} params.container + * @param {Object} params.previewUrl + * @param {Object} params.query + * @param {Object} options */ initialize: function( params, options ) { var deferred = $.Deferred(); @@ -6248,7 +6248,7 @@ /** * Run the preview request. * - * @param {object} deferred jQuery Deferred object to be resolved with + * @param {Object} deferred jQuery Deferred object to be resolved with * the request. */ run: function( deferred ) { @@ -6456,12 +6456,12 @@ * @constructs wp.customize.Previewer * @augments wp.customize.Messenger * - * @param {array} params.allowedUrls + * @param {Array} params.allowedUrls * @param {string} params.container A selector or jQuery element for the preview * frame to be placed. * @param {string} params.form * @param {string} params.previewUrl The URL to preview. - * @param {object} options + * @param {Object} options */ initialize: function( params, options ) { var previewer = this, @@ -6609,11 +6609,11 @@ * @since 4.7.0 * @access public * - * @param {object} data - Data from preview. + * @param {Object} data - Data from preview. * @param {string} data.currentUrl - Current URL. - * @param {object} data.activePanels - Active panels. - * @param {object} data.activeSections Active sections. - * @param {object} data.activeControls Active controls. + * @param {Object} data.activePanels - Active panels. + * @param {Object} data.activeSections Active sections. + * @param {Object} data.activeControls Active controls. * @return {void} */ ready: function( data ) { @@ -6917,8 +6917,8 @@ * @since 4.6.0 * @private * - * @param {object} args - * @param {object} args.settingValidities + * @param {Object} args + * @param {Object} args.settingValidities * @param {boolean} [args.focusInvalidControl=false] * @return {void} */ @@ -6993,7 +6993,7 @@ * * @since 4.6.0 * @param {string[]} settingIds Setting IDs. - * @return {object} Mapping setting ids to arrays of controls. + * @return {Object} Mapping setting ids to arrays of controls. */ api.findControlsForSettings = function findControlsForSettings( settingIds ) { var controls = {}, settingControls; @@ -7401,9 +7401,9 @@ * @since 4.7.0 Added options param. * @access public * - * @param {object} [options] Options. + * @param {Object} [options] Options. * @param {boolean} [options.excludeCustomizedSaved=false] Exclude saved settings in customized response (values pending writing to changeset). - * @return {object} Query vars. + * @return {Object} Query vars. */ query: function( options ) { var queryVars = { @@ -7439,7 +7439,7 @@ * @since 3.4.0 * @since 4.7.0 Added args param and return value. * - * @param {object} [args] Args. + * @param {Object} [args] Args. * @param {string} [args.status=publish] Status. * @param {string} [args.date] Date, in local time in MySQL format. * @param {string} [args.title] Title @@ -8121,7 +8121,7 @@ * @since 4.9.0 * * @param {string} [code] - Code. - * @param {object} [params] - Params. + * @param {Object} [params] - Params. */ initialize: function( code, params ) { var notification = this, _code, _params; @@ -8210,8 +8210,8 @@ * * @since 4.9.0 * - * @param {object} [args] - Args. - * @param {object} [args.lockUser] - Lock user data. + * @param {Object} [args] - Args. + * @param {Object} [args.lockUser] - Lock user data. * @param {boolean} [args.allowOverride=false] - Whether override is allowed. * @return {void} */ @@ -8637,7 +8637,7 @@ * @since 4.7.0 * @access private * - * @param {object} header - Header. + * @param {Object} header - Header. * @param {number} scrollTop - Scroll top. * @param {number} scrollDirection - Scroll direction, negative number being up and positive being down. * @return {void} diff --git a/src/js/_enqueues/wp/customize/nav-menus.js b/src/js/_enqueues/wp/customize/nav-menus.js index 8e35f68b90..1ae1f3435c 100644 --- a/src/js/_enqueues/wp/customize/nav-menus.js +++ b/src/js/_enqueues/wp/customize/nav-menus.js @@ -95,7 +95,7 @@ * @since 4.7.0 * @alias wp.customize.Menus.insertAutoDraftPost * - * @param {object} params - Parameters for the draft post to create. + * @param {Object} params - Parameters for the draft post to create. * @param {string} params.post_type - Post type to add. * @param {string} params.post_title - Post title to use. * @return {jQuery.promise} Promise resolved with the added post. @@ -387,7 +387,7 @@ * @since 4.7.0 Changed function signature to take list of item types instead of single type/object. * @access private * - * @param {Array.} itemTypes List of objects containing type and key. + * @param {Array.} itemTypes List of objects containing type and key. * @param {string} deprecated Formerly the object parameter. * @return {void} */ @@ -905,7 +905,7 @@ * * @since 4.3.0 * - * @param {String} id + * @param {string} id * @param {Object} options */ initialize: function( id, options ) { @@ -2212,7 +2212,7 @@ * * @private * - * @param {Number} offset 1|-1 + * @param {number} offset 1|-1 */ _changePosition: function( offset ) { var control = this, @@ -2272,7 +2272,7 @@ * * @private * - * @param {Number} offset 1|-1 + * @param {number} offset 1|-1 */ _changeDepth: function( offset ) { if ( 1 !== offset && -1 !== offset ) { @@ -2655,7 +2655,7 @@ * Notice that the UI aspects here are handled by wpNavMenu.initSortables() * which is called in MenuSection.onChangeExpanded() * - * @param {object} menuList - The element that has sortable(). + * @param {Object} menuList - The element that has sortable(). */ _setupSortable: function( menuList ) { var control = this; @@ -2854,7 +2854,7 @@ /** * Enable/disable the reordering UI * - * @param {Boolean} showOrHide to enable/disable reordering + * @param {boolean} showOrHide to enable/disable reordering */ toggleReordering: function( showOrHide ) { var addNewItemBtn = this.container.find( '.add-new-menu-item' ), @@ -2994,7 +2994,7 @@ /** * Add a new item to this menu. * - * @param {object} item - Value for the nav_menu_item setting to be created. + * @param {Object} item - Value for the nav_menu_item setting to be created. * @return {wp.customize.Menus.controlConstructor.nav_menu_item} The newly-created nav_menu_item control instance. */ addItemToMenu: function( item ) { @@ -3135,9 +3135,9 @@ * * @alias wp.customize.Menus.applySavedData * - * @param {object} data - * @param {array} data.nav_menu_updates - * @param {array} data.nav_menu_item_updates + * @param {Object} data + * @param {Array} data.nav_menu_updates + * @param {Array} data.nav_menu_item_updates */ api.Menus.applySavedData = function( data ) { @@ -3394,7 +3394,7 @@ * @alias wp.customize.Menus.getMenuItemControl * * @param {string} menuItemId - * @return {object|null} + * @return {Object|null} */ api.Menus.getMenuItemControl = function( menuItemId ) { return api.control( menuItemIdToSettingId( menuItemId ) ); @@ -3403,7 +3403,7 @@ /** * @alias wp.customize.Menus~menuItemIdToSettingId * - * @param {String} menuItemId + * @param {string} menuItemId */ function menuItemIdToSettingId( menuItemId ) { return 'nav_menu_item[' + menuItemId + ']'; diff --git a/src/js/_enqueues/wp/customize/preview-nav-menus.js b/src/js/_enqueues/wp/customize/preview-nav-menus.js index d9a7464016..b5bec37b52 100644 --- a/src/js/_enqueues/wp/customize/preview-nav-menus.js +++ b/src/js/_enqueues/wp/customize/preview-nav-menus.js @@ -98,7 +98,7 @@ wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function( * @param {string} options.params.navMenuArgs.args_hmac * @param {string} [options.params.navMenuArgs.theme_location] * @param {number} [options.params.navMenuArgs.menu] - * @param {object} [options.constructingContainerContext] + * @param {Object} [options.constructingContainerContext] */ initialize: function( id, options ) { var partial = this, matches, argsHmac; @@ -132,8 +132,8 @@ wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function( * * @since 4.5.0 * @param {wp.customize.Value|string} setting - Object or ID. - * @param {number|object|false|null} newValue - New value, or null if the setting was just removed. - * @param {number|object|false|null} oldValue - Old value, or null if the setting was just added. + * @param {number|Object|false|null} newValue - New value, or null if the setting was just removed. + * @param {number|Object|false|null} oldValue - Old value, or null if the setting was just added. * @return {boolean} */ isRelatedSetting: function( setting, newValue, oldValue ) { @@ -263,7 +263,7 @@ wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function( /** * Request full refresh if there are nav menu instances that lack partials which also match the supplied args. * - * @param {object} navMenuInstanceArgs + * @param {Object} navMenuInstanceArgs */ self.handleUnplacedNavMenuInstances = function( navMenuInstanceArgs ) { var unplacedNavMenuInstances; @@ -283,7 +283,7 @@ wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function( * @since 4.5.0 * * @param {wp.customize.Value} setting - * @param {object} [options] + * @param {Object} [options] * @param {boolean} options.fire Whether to invoke the callback after binding. * This is used when a dynamic setting is added. * @return {boolean} Whether the setting was bound. @@ -370,8 +370,8 @@ wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function( * * @since 4.5.0 * - * @param {object} newItem New value for nav_menu_item[] setting. - * @param {object} oldItem Old value for nav_menu_item[] setting. + * @param {Object} newItem New value for nav_menu_item[] setting. + * @param {Object} oldItem Old value for nav_menu_item[] setting. * @this {wp.customize.Value} */ self.onChangeNavMenuItemSetting = function( newItem, oldItem ) { diff --git a/src/js/_enqueues/wp/customize/preview.js b/src/js/_enqueues/wp/customize/preview.js index 9e048dd0f6..bcff0bc251 100644 --- a/src/js/_enqueues/wp/customize/preview.js +++ b/src/js/_enqueues/wp/customize/preview.js @@ -102,8 +102,8 @@ */ api.Preview = api.Messenger.extend(/** @lends wp.customize.Preview.prototype */{ /** - * @param {object} params - Parameters to configure the messenger. - * @param {object} options - Extend any instance parameter or method with this object. + * @param {Object} params - Parameters to configure the messenger. + * @param {Object} options - Extend any instance parameter or method with this object. */ initialize: function( params, options ) { var preview = this, urlParser = document.createElement( 'a' ); @@ -276,8 +276,8 @@ * @param {string} element.search Query string. * @param {string} element.pathname Path. * @param {string} element.host Host. - * @param {object} [options] - * @param {object} [options.allowAdminAjax=false] Allow admin-ajax.php requests. + * @param {Object} [options] + * @param {Object} [options.allowAdminAjax=false] Allow admin-ajax.php requests. * @return {boolean} Is appropriate for changeset link. */ api.isLinkPreviewable = function isLinkPreviewable( element, options ) { @@ -399,10 +399,10 @@ /** * Rewrite Ajax requests to inject customizer state. * - * @param {object} options Options. + * @param {Object} options Options. * @param {string} options.type Type. * @param {string} options.url URL. - * @param {object} originalOptions Original options. + * @param {Object} originalOptions Original options. * @param {XMLHttpRequest} xhr XHR. * @return {void} */ diff --git a/src/js/_enqueues/wp/customize/selective-refresh.js b/src/js/_enqueues/wp/customize/selective-refresh.js index 9fee9690d0..7150c8722b 100644 --- a/src/js/_enqueues/wp/customize/selective-refresh.js +++ b/src/js/_enqueues/wp/customize/selective-refresh.js @@ -60,13 +60,13 @@ wp.customize.selectiveRefresh = ( function( $, api ) { * @since 4.5.0 * * @param {string} id - Unique identifier for the partial instance. - * @param {object} options - Options hash for the partial instance. + * @param {Object} options - Options hash for the partial instance. * @param {string} options.type - Type of partial (e.g. nav_menu, widget, etc) * @param {string} options.selector - jQuery selector to find the container element in the page. - * @param {array} options.settings - The IDs for the settings the partial relates to. + * @param {Array} options.settings - The IDs for the settings the partial relates to. * @param {string} options.primarySetting - The ID for the primary setting the partial renders. - * @param {bool} options.fallbackRefresh - Whether to refresh the entire preview in case of a partial refresh failure. - * @param {object} [options.params] - Deprecated wrapper for the above properties. + * @param {boolean} options.fallbackRefresh - Whether to refresh the entire preview in case of a partial refresh failure. + * @param {Object} [options.params] - Deprecated wrapper for the above properties. */ initialize: function( id, options ) { var partial = this; @@ -285,7 +285,7 @@ wp.customize.selectiveRefresh = ( function( $, api ) { * * @since 4.5.0 * - * @return {String[]} + * @return {string[]} */ settings: function() { var partial = this; @@ -406,8 +406,8 @@ wp.customize.selectiveRefresh = ( function( $, api ) { * * @param {Placement} placement * @param {Element|jQuery} [placement.container] - This param will be empty if there was no element matching the selector. - * @param {string|object|boolean} placement.addedContent - Rendered HTML content, a data object for JS templates to render, or false if no render. - * @param {object} [placement.context] - Optional context information about the container. + * @param {string|Object|boolean} placement.addedContent - Rendered HTML content, a data object for JS templates to render, or false if no render. + * @param {Object} [placement.context] - Optional context information about the container. * @return {boolean} Whether the rendering was successful and the fallback was not invoked. */ renderContent: function( placement ) { @@ -602,12 +602,12 @@ wp.customize.selectiveRefresh = ( function( $, api ) { * * @since 4.5.0 * - * @param {object} args + * @param {Object} args * @param {Partial} args.partial * @param {jQuery|Element} [args.container] * @param {Node} [args.startNode] * @param {Node} [args.endNode] - * @param {object} [args.context] + * @param {Object} [args.context] * @param {string} [args.addedContent] * @param {jQuery|DocumentFragment} [args.removedNodes] */ @@ -645,7 +645,7 @@ wp.customize.selectiveRefresh = ( function( $, api ) { * @since 4.5.0 * @see wp.customize.previewer.query() * - * @return {object} + * @return {Object} */ self.getCustomizeQuery = function() { var dirtyCustomized = {}; diff --git a/src/js/_enqueues/wp/customize/widgets.js b/src/js/_enqueues/wp/customize/widgets.js index a4266b08d7..990a3e19b5 100644 --- a/src/js/_enqueues/wp/customize/widgets.js +++ b/src/js/_enqueues/wp/customize/widgets.js @@ -459,7 +459,7 @@ /** * @param {jQuery.Event} e * @param {jQuery} widget - * @param {String} newForm + * @param {string} newForm */ rss: function( e, widget, newForm ) { var oldWidgetError = widget.find( '.widget-error:first' ), @@ -968,7 +968,7 @@ * * @since 4.1.0 * - * @param {Boolean} active + * @param {boolean} active * @param {Object} args * @param {function} args.completeCallback */ @@ -1075,7 +1075,7 @@ * Get the state for an input depending on its type. * * @param {jQuery|Element} input - * @return {string|boolean|array|*} + * @return {string|boolean|Array|*} * @private */ _getInputState: function( input ) { @@ -1095,7 +1095,7 @@ * Update an input's state based on its type. * * @param {jQuery|Element} input - * @param {string|boolean|array|*} state + * @param {string|boolean|Array|*} state * @private */ _setInputState: function ( input, state ) { @@ -1143,10 +1143,10 @@ * Submit the widget form via Ajax and get back the updated instance, * along with the new widget control form to render. * - * @param {object} [args] + * @param {Object} [args] * @param {Object|null} [args.instance=null] When the model changes, the instance is sent here; otherwise, the inputs from the form are used * @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. - * @param {Boolean} [args.ignoreActiveElement=false] Whether or not updating a field will be deferred if focus is still on the element. + * @param {boolean} [args.ignoreActiveElement=false] Whether or not updating a field will be deferred if focus is still on the element. */ updateWidget: function( args ) { var self = this, instanceOverride, completeCallback, $widgetRoot, $widgetContent, @@ -1398,7 +1398,7 @@ /** * Respond to change in the expanded state. * - * @param {Boolean} expanded + * @param {boolean} expanded * @param {Object} args merged on top of this.defaultActiveArguments */ onChangeExpanded: function ( expanded, args ) { @@ -1498,7 +1498,7 @@ /** * Get the position (index) of the widget in the containing sidebar * - * @return {Number} + * @return {number} */ getWidgetSidebarPosition: function() { var sidebarWidgetIds, position; @@ -1530,7 +1530,7 @@ /** * @private * - * @param {Number} offset 1|-1 + * @param {number} offset 1|-1 */ _moveWidgetByOne: function( offset ) { var i, sidebarWidgetsSetting, sidebarWidgetIds, adjacentWidgetId; @@ -1549,7 +1549,7 @@ /** * Toggle visibility of the widget move area * - * @param {Boolean} [showOrHide] + * @param {boolean} [showOrHide] */ toggleWidgetMoveArea: function( showOrHide ) { var self = this, $moveWidgetArea; @@ -2007,7 +2007,7 @@ /** * Enable/disable the reordering UI * - * @param {Boolean} showOrHide to enable/disable reordering + * @param {boolean} showOrHide to enable/disable reordering * * @todo We should have a reordering state instead and rename this to onChangeReordering */ @@ -2065,7 +2065,7 @@ /** * @param {string} widgetId or an id_base for adding a previously non-existing widget. - * @return {object|false} widget_form control instance, or false on error. + * @return {Object|false} widget_form control instance, or false on error. */ addWidget: function( widgetId ) { var self = this, controlHtml, $widget, controlType = 'widget_form', controlContainer, controlConstructor, @@ -2246,7 +2246,7 @@ /** * Given a widget control, find the sidebar widgets control that contains it. * @param {string} widgetId - * @return {object|null} + * @return {Object|null} */ api.Widgets.getSidebarWidgetControlContainingWidget = function( widgetId ) { var foundControl = null; @@ -2265,7 +2265,7 @@ * Given a widget ID for a widget appearing in the preview, get the widget form control associated with it. * * @param {string} widgetId - * @return {object|null} + * @return {Object|null} */ api.Widgets.getWidgetFormControlForWidget = function( widgetId ) { var foundControl = null; @@ -2333,7 +2333,7 @@ } /** - * @param {String} widgetId + * @param {string} widgetId * @return {Object} */ function parseWidgetId( widgetId ) { @@ -2355,8 +2355,8 @@ } /** - * @param {String} widgetId - * @return {String} settingId + * @param {string} widgetId + * @return {string} settingId */ function widgetIdToSettingId( widgetId ) { var parsed = parseWidgetId( widgetId ), settingId; diff --git a/src/js/_enqueues/wp/editor/base.js b/src/js/_enqueues/wp/editor/base.js index 602fad7355..aa9948ebd6 100644 --- a/src/js/_enqueues/wp/editor/base.js +++ b/src/js/_enqueues/wp/editor/base.js @@ -473,7 +473,7 @@ window.wp = window.wp || {}; * The method directly manipulates the `textarea` content, to allow TinyMCE plugins * to run after the markers are added. * - * @param {object} $textarea TinyMCE's textarea wrapped as a DomQuery object + * @param {Object} $textarea TinyMCE's textarea wrapped as a DomQuery object */ function addHTMLBookmarkInTextAreaContent( $textarea ) { if ( ! $textarea || ! $textarea.length ) { @@ -561,7 +561,7 @@ window.wp = window.wp || {}; * By default TinyMCE wraps loose inline tags in a `

`. * When removing selection markers an empty `

` may be left behind, remove it. * - * @param {object} $marker The marker to be removed from the editor DOM, wrapped in an instnce of `editor.$` + * @param {Object} $marker The marker to be removed from the editor DOM, wrapped in an instnce of `editor.$` */ function removeSelectionMarker( $marker ) { var $markerParent = $marker.parent(); @@ -1132,8 +1132,8 @@ window.wp = window.wp || {}; * * @memberof switchEditors * - * @param {String} html The content from the visual editor. - * @return {String} the filtered content. + * @param {string} html The content from the visual editor. + * @return {string} the filtered content. */ function pre_wpautop( html ) { var obj = { o: exports, data: html, unfiltered: html }; @@ -1158,8 +1158,8 @@ window.wp = window.wp || {}; * * @memberof switchEditors * - * @param {String} text The content from the text editor. - * @return {String} filtered content. + * @param {string} text The content from the text editor. + * @return {string} filtered content. */ function wpautop( text ) { var obj = { o: exports, data: text, unfiltered: text }; @@ -1225,7 +1225,7 @@ window.wp = window.wp || {}; * * @param {string} id The HTML id of the textarea that is used for the editor. * Has to be jQuery compliant. No brackets, special chars, etc. - * @param {object} settings Example: + * @param {Object} settings Example: * settings = { * // See https://www.tinymce.com/docs/configure/integration-and-setup/. * // Alternatively set to `true` to use the defaults. diff --git a/src/js/_enqueues/wp/editor/dfw.js b/src/js/_enqueues/wp/editor/dfw.js index 2fc580c1fe..a47c548dc9 100644 --- a/src/js/_enqueues/wp/editor/dfw.js +++ b/src/js/_enqueues/wp/editor/dfw.js @@ -204,7 +204,7 @@ /** * Gets the offset of the editor. * - * @return {Number|Boolean} Returns the offset of the editor + * @return {number|boolean} Returns the offset of the editor * or false if there is no offset height. */ function mceGetCursorOffset() { diff --git a/src/js/_enqueues/wp/mce-view.js b/src/js/_enqueues/wp/mce-view.js index 1fca3d6d35..a9b57b601d 100644 --- a/src/js/_enqueues/wp/mce-view.js +++ b/src/js/_enqueues/wp/mce-view.js @@ -46,7 +46,7 @@ /** * Registers a new view type. * - * @param {String} type The view type. + * @param {string} type The view type. * @param {Object} extend An object to extend wp.mce.View.prototype with. */ register: function( type, extend ) { @@ -56,7 +56,7 @@ /** * Unregisters a view type. * - * @param {String} type The view type. + * @param {string} type The view type. */ unregister: function( type ) { delete views[ type ]; @@ -65,7 +65,7 @@ /** * Returns the settings of a view type. * - * @param {String} type The view type. + * @param {string} type The view type. * * @return {Function} The view constructor. */ @@ -88,10 +88,10 @@ * replacing any matches with markers, * and creates a new instance for every match. * - * @param {String} content The string to scan. + * @param {string} content The string to scan. * @param {tinymce.Editor} editor The editor. * - * @return {String} The string with markers. + * @return {string} The string with markers. */ setMarkers: function( content, editor ) { var pieces = [ { content: content } ], @@ -149,10 +149,10 @@ /** * Create a view instance. * - * @param {String} type The view type. - * @param {String} text The textual representation of the view. + * @param {string} type The view type. + * @param {string} text The textual representation of the view. * @param {Object} options Options. - * @param {Boolean} force Recreate the instance. Optional. + * @param {boolean} force Recreate the instance. Optional. * * @return {wp.mce.View} The view instance. */ @@ -190,7 +190,7 @@ /** * Get a view instance. * - * @param {(String|HTMLElement)} object The textual representation of the view or the view node. + * @param {(string|HTMLElement)} object The textual representation of the view or the view node. * * @return {wp.mce.View} The view instance or undefined. */ @@ -207,7 +207,7 @@ * * @param {HTMLElement} node The view node. * - * @return {String} The textual representation of the view. + * @return {string} The textual representation of the view. */ getText: function( node ) { return decodeURIComponent( $( node ).attr( 'data-wpview-text' ) || '' ); @@ -216,7 +216,7 @@ /** * Renders all view nodes that are not yet rendered. * - * @param {Boolean} force Rerender all view nodes. + * @param {boolean} force Rerender all view nodes. */ render: function( force ) { _.each( instances, function( instance ) { @@ -227,10 +227,10 @@ /** * Update the text of a given view node. * - * @param {String} text The new text. + * @param {string} text The new text. * @param {tinymce.Editor} editor The TinyMCE editor instance the view node is in. * @param {HTMLElement} node The view node to update. - * @param {Boolean} force Recreate the instance. Optional. + * @param {boolean} force Recreate the instance. Optional. */ update: function( text, editor, node, force ) { var instance = this.getInstance( node ); @@ -317,8 +317,8 @@ /** * Renders all view nodes tied to this view instance that are not yet rendered. * - * @param {String} content The content to render. Optional. - * @param {Boolean} force Rerender all view nodes tied to this view instance. Optional. + * @param {string} content The content to render. Optional. + * @param {boolean} force Rerender all view nodes tied to this view instance. Optional. */ render: function( content, force ) { if ( content != null ) { @@ -385,7 +385,7 @@ * Gets all view nodes tied to this view instance. * * @param {Function} callback A callback. - * @param {Boolean} rendered Get (un)rendered view nodes. Optional. + * @param {boolean} rendered Get (un)rendered view nodes. Optional. */ getNodes: function( callback, rendered ) { this.getEditors( function( editor ) { @@ -473,7 +473,7 @@ * * @param {*} content The content to set. * @param {Function} callback A callback. Optional. - * @param {Boolean} rendered Only set for (un)rendered nodes. Optional. + * @param {boolean} rendered Only set for (un)rendered nodes. Optional. */ setContent: function( content, callback, rendered ) { if ( _.isObject( content ) && ( content.sandbox || content.head || content.body.indexOf( '