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
This commit is contained in:
Dominik Schilling (ocean90) 2014-12-15 19:53:55 +00:00
parent eb3ea331f0
commit c17317912a

View File

@ -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'),