[wp-trac] [WordPress Trac] #35878: In `wp.media.view.Attachment.render` tested parameter is missing a default. (was: In `wp.media.view.Attachment.render` tested parameter is missing an initialization.)

WordPress Trac noreply at wordpress.org
Fri Feb 19 20:21:43 UTC 2016


#35878: In `wp.media.view.Attachment.render` tested parameter is missing a default.
-----------------------------------+------------------------------
 Reporter:  georgestephanis        |       Owner:
     Type:  defect (bug)           |      Status:  new
 Priority:  lowest                 |   Milestone:  Awaiting Review
Component:  Media                  |     Version:  trunk
 Severity:  minor                  |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:  javascript
-----------------------------------+------------------------------
Description changed by georgestephanis:

Old description:

> I'm still familiarizing myself with Media, so please feel free to close
> if this is silly.
>
> On line ~116 in `wp-includes/js/media/views/attachment.js` we're testing:
>
> ```
> if ( options.nonces ) {
> ```
>
> but `options.nonces` isn't initialized above in the `options` defaults.
>
> For clarity's sake, should we initialize it to `false`?  (also, it keeps
> my IDE from getting cranky about it)
>
> Patch attached.
>
> Also -- `options.percent` isn't initialized either -- but as that seems
> to be conditionally initialized down below (only initialized if
> `options.uploading` is truthy), I didn't muck around with it in this
> patch.

New description:

 I'm still familiarizing myself with Media, so please feel free to just
 close/wontfix if this is silly.

 On line ~116 in `wp-includes/js/media/views/attachment.js` we're testing:

 ```
 if ( options.nonces ) {
 ```

 but `options.nonces` isn't initialized above in the `options` defaults.

 For clarity's sake, should we initialize it to `false`?  (also, it keeps
 my IDE from getting cranky about it)

 Patch attached.

 Also -- `options.percent` isn't initialized either -- but as that seems to
 be conditionally initialized down below (only initialized if
 `options.uploading` is truthy), I didn't muck around with it in this
 patch.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35878#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list