WordPress.org

Make WordPress Core

Changeset 41010


Ignore:
Timestamp:
07/06/2017 12:45:24 AM (4 years ago)
Author:
joemcgill
Message:

Sanity check $uploaderToggler in wp.media.view.UploaderInline.

This ensures $uploaderToggler exists before checking length so any views
extending or scripts accessing this view, won't encounter errors that stop execution.

See #41231.

Merges [41009] to the 4.8 branch.

Location:
branches/4.8
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

  • branches/4.8/src/wp-includes/js/media-views.js

    r40772 r41010  
    82288228    show: function() {
    82298229        this.$el.removeClass( 'hidden' );
    8230         if ( this.controller.$uploaderToggler.length ) {
     8230        if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) {
    82318231            this.controller.$uploaderToggler.attr( 'aria-expanded', 'true' );
    82328232        }
     
    82348234    hide: function() {
    82358235        this.$el.addClass( 'hidden' );
    8236         if ( this.controller.$uploaderToggler.length ) {
     8236        if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) {
    82378237            this.controller.$uploaderToggler
    82388238                .attr( 'aria-expanded', 'false' )
  • branches/4.8/src/wp-includes/js/media/views/uploader/inline.js

    r40359 r41010  
    120120    show: function() {
    121121        this.$el.removeClass( 'hidden' );
    122         if ( this.controller.$uploaderToggler.length ) {
     122        if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) {
    123123            this.controller.$uploaderToggler.attr( 'aria-expanded', 'true' );
    124124        }
     
    126126    hide: function() {
    127127        this.$el.addClass( 'hidden' );
    128         if ( this.controller.$uploaderToggler.length ) {
     128        if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) {
    129129            this.controller.$uploaderToggler
    130130                .attr( 'aria-expanded', 'false' )
Note: See TracChangeset for help on using the changeset viewer.