From c17317912a2440ed813452cd7b14c32a0c14bc07 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Mon, 15 Dec 2014 19:53:55 +0000 Subject: [PATCH] Customizer: Import missing `wp.customize.Control.prototype._toggleActive`. Check also if `completeCallback` is set before calling it. props westonruter. see #30701. git-svn-id: https://develop.svn.wordpress.org/trunk@30871 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/customize-controls.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index ad54e013ec..d721dab1da 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -252,7 +252,9 @@ if ( ! $.contains( document, this.container ) ) { // jQuery.fn.slideUp is not hiding an element if it is not in the DOM this.container.toggle( active ); - args.completeCallback(); + if ( args.completeCallback ) { + args.completeCallback(); + } } else if ( active ) { this.container.stop( true, true ).slideDown( duration, args.completeCallback ); } else { @@ -820,7 +822,7 @@ // Watch for changes to the section state inject = function ( sectionId ) { var parentContainer; - if ( ! sectionId ) { // @todo allow a control to be embeded without a section, for instance a control embedded in the frontend + if ( ! sectionId ) { // @todo allow a control to be embedded without a section, for instance a control embedded in the frontend return; } // Wait for the section to be registered @@ -878,7 +880,9 @@ if ( ! $.contains( document, this.container ) ) { // jQuery.fn.slideUp is not hiding an element if it is not in the DOM this.container.toggle( active ); - args.completeCallback(); + if ( args.completeCallback ) { + args.completeCallback(); + } } else if ( active ) { this.container.slideDown( args.duration, args.completeCallback ); } else { @@ -913,6 +917,13 @@ */ deactivate: Container.prototype.deactivate, + /** + * Re-use _toggleActive from Container class. + * + * @access private + */ + _toggleActive: Container.prototype._toggleActive, + dropdownInit: function() { var control = this, statuses = this.container.find('.dropdown-status'),