WordPress.org

Make WordPress Core

Changeset 41009


Ignore:
Timestamp:
07/06/17 00:40:59 (4 months 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.

Props Blackbam, yahil.
Fixes #41231.

Location:
trunk/src/wp-includes/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media-views.js

    r40902 r41009  
    82298229    show: function() { 
    82308230        this.$el.removeClass( 'hidden' ); 
    8231         if ( this.controller.$uploaderToggler.length ) { 
     8231        if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) { 
    82328232            this.controller.$uploaderToggler.attr( 'aria-expanded', 'true' ); 
    82338233        } 
     
    82358235    hide: function() { 
    82368236        this.$el.addClass( 'hidden' ); 
    8237         if ( this.controller.$uploaderToggler.length ) { 
     8237        if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) { 
    82388238            this.controller.$uploaderToggler 
    82398239                .attr( 'aria-expanded', 'false' ) 
  • trunk/src/wp-includes/js/media/views/uploader/inline.js

    r40359 r41009  
    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.