Make WordPress Core

Changeset 40375


Ignore:
Timestamp:
04/04/2017 06:51:39 AM (7 years ago)
Author:
swissspidy
Message:

Customize: Fix failure to collapse expanded sections and panels that become deactivated.

Improve jsdoc for onChangeActive function. Restores fix from [34557] which got dropped in [38648].

Props dlh, westonruter.
See #34391, #33509.
Fixes #39430.

Merges [40304] to the 4.7 branch.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-admin/js/customize-controls.js

    r40345 r40375  
    529529         * @since 4.1.0
    530530         *
    531          * @param {Boolean} active
    532          * @param {Object}  args
    533          * @param {Object}  args.duration
    534          * @param {Object}  args.completeCallback
     531         * @param {boolean}  active - The active state to transiution to.
     532         * @param {Object}   [args] - Args.
     533         * @param {Object}   [args.duration] - The duration for the slideUp/slideDown animation.
     534         * @param {boolean}  [args.unchanged] - Whether the state is already known to not be changed, and so short-circuit with calling completeCallback early.
     535         * @param {Function} [args.completeCallback] - Function to call when the slideUp/slideDown has completed.
    535536         */
    536537        onChangeActive: function( active, args ) {
     
    565566            }
    566567
    567             if ( ! $.contains( document, headContainer ) ) {
    568                 // jQuery.fn.slideUp is not hiding an element if it is not in the DOM
     568            if ( ! $.contains( document, headContainer.get( 0 ) ) ) {
     569                // If the element is not in the DOM, then jQuery.fn.slideUp() does nothing. In this case, a hard toggle is required instead.
    569570                headContainer.toggle( active );
    570571                if ( args.completeCallback ) {
     
    572573                }
    573574            } else if ( active ) {
    574                 headContainer.stop( true, true ).slideDown( duration, args.completeCallback );
     575                headContainer.slideDown( duration, args.completeCallback );
    575576            } else {
    576577                if ( construct.expanded() ) {
     
    578579                        duration: duration,
    579580                        completeCallback: function() {
    580                             headContainer.stop( true, true ).slideUp( duration, args.completeCallback );
     581                            headContainer.slideUp( duration, args.completeCallback );
    581582                        }
    582583                    });
    583584                } else {
    584                     headContainer.stop( true, true ).slideUp( duration, args.completeCallback );
     585                    headContainer.slideUp( duration, args.completeCallback );
    585586                }
    586587            }
Note: See TracChangeset for help on using the changeset viewer.