WordPress.org

Make WordPress Core

Changeset 30871


Ignore:
Timestamp:
12/15/2014 07:53:55 PM (7 years ago)
Author:
ocean90
Message:

Customizer: Import missing wp.customize.Control.prototype._toggleActive.

Check also if completeCallback is set before calling it.

props westonruter.
see #30701.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-controls.js

    r30738 r30871  
    253253                // jQuery.fn.slideUp is not hiding an element if it is not in the DOM
    254254                this.container.toggle( active );
    255                 args.completeCallback();
     255                if ( args.completeCallback ) {
     256                    args.completeCallback();
     257                }
    256258            } else if ( active ) {
    257259                this.container.stop( true, true ).slideDown( duration, args.completeCallback );
     
    821823            inject = function ( sectionId ) {
    822824                var parentContainer;
    823                 if ( ! sectionId ) { // @todo allow a control to be embeded without a section, for instance a control embedded in the frontend
     825                if ( ! sectionId ) { // @todo allow a control to be embedded without a section, for instance a control embedded in the frontend
    824826                    return;
    825827                }
     
    879881                // jQuery.fn.slideUp is not hiding an element if it is not in the DOM
    880882                this.container.toggle( active );
    881                 args.completeCallback();
     883                if ( args.completeCallback ) {
     884                    args.completeCallback();
     885                }
    882886            } else if ( active ) {
    883887                this.container.slideDown( args.duration, args.completeCallback );
     
    913917         */
    914918        deactivate: Container.prototype.deactivate,
     919
     920        /**
     921         * Re-use _toggleActive from Container class.
     922         *
     923         * @access private
     924         */
     925        _toggleActive: Container.prototype._toggleActive,
    915926
    916927        dropdownInit: function() {
Note: See TracChangeset for help on using the changeset viewer.