Make WordPress Core

Changeset 32119


Ignore:
Timestamp:
04/13/2015 10:09:35 PM (11 years ago)
Author:
ocean90
Message:

Customizer Theme Switcher: Don't re-render a theme control if it has already been rendered.

Move initialization of $customizeSidebar to api.ThemesSection.initialize() to prevent cases where the result can be undefined.

props westonruter, ocean90.
fixes #31793.

File:
1 edited

Legend:

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

    r32091 r32119  
    555555                screenshotQueue: null,
    556556                $window: $( window ),
    557                 $customizeSidebar: $( '.wp-full-overlay-sidebar-content:first' ),
     557
     558                /**
     559                 * @since 4.2.0
     560                 */
     561                initialize: function () {
     562                        this.$customizeSidebar = $( '.wp-full-overlay-sidebar-content:first' );
     563                        return api.Section.prototype.initialize.apply( this, arguments );
     564                },
    558565
    559566                /**
     
    19521959
    19531960                touchDrag: false,
     1961                isRendered: false,
    19541962
    19551963                /**
     
    19621970                                renderContentArgs = arguments;
    19631971
    1964                         api.section( control.section(), function ( section ) {
     1972                        api.section( control.section(), function( section ) {
    19651973                                if ( section.expanded() ) {
    19661974                                        api.Control.prototype.renderContent.apply( control, renderContentArgs );
     1975                                        control.isRendered = true;
    19671976                                } else {
    1968                                         section.expanded.bind( function ( expanded ) {
    1969                                                 if ( expanded ) {
     1977                                        section.expanded.bind( function( expanded ) {
     1978                                                if ( expanded && ! control.isRendered ) {
    19701979                                                        api.Control.prototype.renderContent.apply( control, renderContentArgs );
     1980                                                        control.isRendered = true;
    19711981                                                }
    19721982                                        } );
Note: See TracChangeset for help on using the changeset viewer.