From 9c4f26159814eb7aca6f69383ae98aba79ef9ea8 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 26 Aug 2015 07:25:20 +0000 Subject: [PATCH] Customizer: Ensure persistence of unchanged `active` state for controls, sections, and panels. Props nikeo, westonruter. Fixes #33428 for trunk. See also #33494. git-svn-id: https://develop.svn.wordpress.org/trunk@33754 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/customize-controls.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 1e5103a914..84f7faf739 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -284,8 +284,15 @@ * @param {Object} args.duration * @param {Object} args.completeCallback */ - onChangeActive: function ( active, args ) { + onChangeActive: function( active, args ) { var duration, construct = this; + if ( args.unchanged ) { + if ( args.completeCallback ) { + args.completeCallback(); + } + return; + } + duration = ( 'resolved' === api.previewer.deferred.active.state() ? args.duration : 0 ); if ( ! $.contains( document, construct.container[0] ) ) { // jQuery.fn.slideUp is not hiding an element if it is not in the DOM @@ -1497,6 +1504,13 @@ * @param {Callback} args.completeCallback */ onChangeActive: function ( active, args ) { + if ( args.unchanged ) { + if ( args.completeCallback ) { + args.completeCallback(); + } + return; + } + if ( ! $.contains( document, this.container ) ) { // jQuery.fn.slideUp is not hiding an element if it is not in the DOM this.container.toggle( active );