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.

Built from https://develop.svn.wordpress.org/branches/4.8@41010


git-svn-id: http://core.svn.wordpress.org/branches/4.8@40860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Joe McGill 2017-07-06 00:46:33 +00:00
parent b15040f1b2
commit 93db53b77d
2 changed files with 3 additions and 3 deletions

View File

@ -8227,13 +8227,13 @@ UploaderInline = View.extend({
},
show: function() {
this.$el.removeClass( 'hidden' );
if ( this.controller.$uploaderToggler.length ) {
if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) {
this.controller.$uploaderToggler.attr( 'aria-expanded', 'true' );
}
},
hide: function() {
this.$el.addClass( 'hidden' );
if ( this.controller.$uploaderToggler.length ) {
if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) {
this.controller.$uploaderToggler
.attr( 'aria-expanded', 'false' )
// Move focus back to the toggle button when closing the uploader.

File diff suppressed because one or more lines are too long