Skip to content

Commit 4676feb

Browse files
committed
General: Improve JavaScript inline code documentation part 4.
Fixes the JSDoc violations reported by the `lint:jsdoc` updated configuraiton after [63392]. Last part, Developed in WordPress#13251 Props afercia, westonruter. See #65939. Fixes #65951. git-svn-id: https://develop.svn.wordpress.org/trunk@63409 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1f6b8f2 commit 4676feb

19 files changed

Lines changed: 120 additions & 36 deletions

‎src/js/media/views/attachment-compat.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ AttachmentCompat = View.extend(/** @lends wp.media.view.AttachmentCompat.prototy
4242
return View.prototype.dispose.apply( this, arguments );
4343
},
4444
/**
45-
* @return {wp.media.view.AttachmentCompat} Returns itself to allow chaining.
45+
* @return {void|wp.media.view.AttachmentCompat} Returns itself to allow chaining.
4646
*/
4747
render: function() {
4848
var compat = this.model.get('compat');

‎src/js/media/views/attachment.js‎

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
7979
this.listenTo( this.controller.states, 'attachment:compat:waiting attachment:compat:ready', this.updateSave );
8080
},
8181
/**
82+
* Update the view after the model has been saved.
83+
*
8284
* @return {wp.media.view.Attachment} Returns itself to allow chaining.
8385
*/
8486
dispose: function() {
@@ -97,6 +99,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
9799
return this;
98100
},
99101
/**
102+
* Renders the attachment view.
103+
*
100104
* @return {wp.media.view.Attachment} Returns itself to allow chaining.
101105
*/
102106
render: function() {
@@ -167,6 +171,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
167171
},
168172

169173
/**
174+
* Toggles the selection state of the attachment.
175+
*
170176
* @param {Object} event
171177
*/
172178
toggleSelectionHandler: function( event ) {
@@ -221,6 +227,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
221227
this.controller.trigger( 'selection:toggle' );
222228
},
223229
/**
230+
* Toggles the selection state of the attachment.
231+
*
224232
* @param {Object} options
225233
*/
226234
toggleSelection: function( options ) {
@@ -301,7 +309,9 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
301309
this[ this.selected() ? 'select' : 'deselect' ]();
302310
},
303311
/**
304-
* @return {unresolved|boolean}
312+
* Checks if the model is selected in the selection.
313+
*
314+
* @return {void|boolean} True if the model is selected in the selection, false otherwise.
305315
*/
306316
selected: function() {
307317
var selection = this.options.selection;
@@ -310,6 +320,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
310320
}
311321
},
312322
/**
323+
* Selects the model in the selection.
324+
*
313325
* @param {Backbone.Model} model
314326
* @param {Backbone.Collection} collection
315327
*/
@@ -339,6 +351,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
339351
}
340352
},
341353
/**
354+
* Deselects the model in the selection.
355+
*
342356
* @param {Backbone.Model} model
343357
* @param {Backbone.Collection} collection
344358
*/
@@ -357,6 +371,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
357371
.find( '.check' ).attr( 'tabindex', '-1' );
358372
},
359373
/**
374+
* Updates the view to reflect whether the model is the single model in the selection.
375+
*
360376
* @param {Backbone.Model} model
361377
* @param {Backbone.Collection} collection
362378
*/
@@ -372,8 +388,10 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
372388
this.$el.toggleClass( 'details', details === this.model );
373389
},
374390
/**
391+
* Gets the image size object for the specified size.
392+
*
375393
* @param {string} size
376-
* @return {Object}
394+
* @return {Object} Returns an object containing the image size information.
377395
*/
378396
imageSize: function( size ) {
379397
var sizes = this.model.get('sizes'), matched = false;
@@ -405,6 +423,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
405423
};
406424
},
407425
/**
426+
* Update the model's setting with the value from the input.
427+
*
408428
* @param {Object} event
409429
*/
410430
updateSetting: function( event ) {
@@ -456,6 +476,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
456476
});
457477
},
458478
/**
479+
* Updates the view's save status.
480+
*
459481
* @param {string} status
460482
* @return {wp.media.view.Attachment} Returns itself to allow chaining.
461483
*/
@@ -498,6 +520,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
498520
}
499521
},
500522
/**
523+
* Removes the model from the collection.
524+
*
501525
* @param {Object} event
502526
*/
503527
removeFromLibrary: function( event ) {
@@ -513,11 +537,11 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
513537
},
514538

515539
/**
516-
* Add the model if it isn't in the selection, if it is in the selection,
517-
* remove it.
540+
* Adds the model if it isn't in the selection, if it is in the selection,
541+
* removes it.
518542
*
519-
* @param {[type]} event [description]
520-
* @return {[type]} [description]
543+
* @param {Object} event
544+
* @return {void}
521545
*/
522546
checkClickHandler: function ( event ) {
523547
var selection = this.options.selection;

‎src/js/media/views/attachment/details.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ Details = Attachment.extend(/** @lends wp.media.view.Attachment.Details.prototyp
3333
*
3434
* @since 5.5.0
3535
*
36-
* @param {MouseEvent} event A click event.
37-
*
3836
* @return {void}
3937
*/
4038
copyAttachmentDetailsURLClipboard: function() {

‎src/js/media/views/attachments/browser.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var View = wp.media.View,
1717
* @augments wp.Backbone.View
1818
* @augments Backbone.View
1919
*
20-
* @param {object} [options] The options hash passed to the view.
20+
* @param {Object} [options] The options hash passed to the view.
2121
* @param {boolean|string} [options.filters=false] Which filters to show in the browser's toolbar.
2222
* Accepts 'uploaded' and 'all'.
2323
* @param {boolean} [options.search=true] Whether to show the search interface in the

‎src/js/media/views/button-group.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ ButtonGroup = wp.media.View.extend(/** @lends wp.media.view.ButtonGroup.prototyp
3535
},
3636

3737
/**
38-
* @return {wp.media.view.ButtonGroup}
38+
* Renders the button group.
39+
*
40+
* @return {wp.media.view.ButtonGroup} The button group.
3941
*/
4042
render: function() {
4143
this.$el.html( $( _.pluck( this.buttons, 'el' ) ).detach() );

‎src/js/media/views/embed/url.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ EmbedUrl = View.extend(/** @lends wp.media.view.EmbedUrl.prototype */{
3939
}
4040
},
4141
/**
42-
* @return {wp.media.view.EmbedUrl} Returns itself to allow chaining.
42+
* Renders the view.
43+
*
44+
* @return {void|wp.media.view.EmbedUrl} Returns itself to allow chaining.
4345
*/
4446
render: function() {
4547
var $input = this.$input;

‎src/js/media/views/focus-manager.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ var FocusManager = wp.media.View.extend(/** @lends wp.media.view.FocusManager.pr
218218
*
219219
* @since 5.3.0
220220
*
221-
* @param {Object} event jQuery event object.
222-
*
223221
* @return {void}
224222
*/
225223
setupAriaTabs: function() {

‎src/js/media/views/frame.js‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ var Frame = wp.media.View.extend(/** @lends wp.media.view.Frame.prototype */{
8888
},
8989
/**
9090
* Map activeMode collection events to the frame.
91+
*
92+
* @param {Backbone.Model} model
93+
* @param {Backbone.Collection} collection
94+
* @param {Object} options
9195
*/
9296
triggerModeEvents: function( model, collection, options ) {
9397
var collectionEvent,
@@ -113,8 +117,8 @@ var Frame = wp.media.View.extend(/** @lends wp.media.view.Frame.prototype */{
113117
/**
114118
* Activate a mode on the frame.
115119
*
116-
* @param string mode Mode ID.
117-
* @return {this} Returns itself to allow chaining.
120+
* @param {string} mode Mode ID.
121+
* @return {void|this} Returns itself to allow chaining.
118122
*/
119123
activateMode: function( mode ) {
120124
// Bail if the mode is already active.
@@ -130,7 +134,7 @@ var Frame = wp.media.View.extend(/** @lends wp.media.view.Frame.prototype */{
130134
/**
131135
* Deactivate a mode on the frame.
132136
*
133-
* @param string mode Mode ID.
137+
* @param {string} mode Mode ID.
134138
* @return {this} Returns itself to allow chaining.
135139
*/
136140
deactivateMode: function( mode ) {
@@ -152,8 +156,8 @@ var Frame = wp.media.View.extend(/** @lends wp.media.view.Frame.prototype */{
152156
/**
153157
* Check if a mode is enabled on the frame.
154158
*
155-
* @param string mode Mode ID.
156-
* @return bool
159+
* @param {string} mode Mode ID.
160+
* @return {boolean} True if the mode is active, false otherwise.
157161
*/
158162
isModeActive: function( mode ) {
159163
return Boolean( this.activeModes.where( { id: mode } ).length );

‎src/js/media/views/frame/edit-attachments.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ EditAttachments = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.EditAtta
207207

208208
/**
209209
* Rerender the view.
210+
* @param {wp.media.model.Attachment} model The attachment model to render.
210211
*/
211212
rerender: function( model ) {
212213
this.stopListening( this.model );
@@ -285,6 +286,8 @@ EditAttachments = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.EditAtta
285286
* Respond to the keyboard events: Alt + right arrow, Alt + left arrow,
286287
* except when focus is in a form field. Requires the Alt modifier key to
287288
* avoid interfering with screen reader navigation.
289+
*
290+
* @param {Event} event The keyboard event.
288291
*/
289292
keyEvent: function( event ) {
290293
if ( ( 'INPUT' === event.target.nodeName || 'TEXTAREA' === event.target.nodeName || 'SELECT' === event.target.nodeName ) && ! event.target.disabled ) {

‎src/js/media/views/frame/manage.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ Manage = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.Manage.prototype
196196

197197
/**
198198
* Click handler for the `Add New` button.
199+
*
200+
* @param {Event} event The click event.
199201
*/
200202
addNewClickHandler: function( event ) {
201203
event.preventDefault();
@@ -208,6 +210,8 @@ Manage = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.Manage.prototype
208210

209211
/**
210212
* Open the Edit Attachment modal.
213+
*
214+
* @param {wp.media.model.Attachment} model The attachment model to edit.
211215
*/
212216
openEditAttachmentModal: function( model ) {
213217
// Create a new EditAttachment frame, passing along the library and the attachment model.

0 commit comments

Comments
 (0)