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. Built from https://develop.svn.wordpress.org/trunk@32119 git-svn-id: http://core.svn.wordpress.org/trunk@32098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
da928039a6
commit
7b24017cdb
|
@ -554,7 +554,14 @@
|
|||
template: '',
|
||||
screenshotQueue: null,
|
||||
$window: $( window ),
|
||||
$customizeSidebar: $( '.wp-full-overlay-sidebar-content:first' ),
|
||||
|
||||
/**
|
||||
* @since 4.2.0
|
||||
*/
|
||||
initialize: function () {
|
||||
this.$customizeSidebar = $( '.wp-full-overlay-sidebar-content:first' );
|
||||
return api.Section.prototype.initialize.apply( this, arguments );
|
||||
},
|
||||
|
||||
/**
|
||||
* @since 4.2.0
|
||||
|
@ -1951,6 +1958,7 @@
|
|||
api.ThemeControl = api.Control.extend({
|
||||
|
||||
touchDrag: false,
|
||||
isRendered: false,
|
||||
|
||||
/**
|
||||
* Defer rendering the theme control until the section is displayed.
|
||||
|
@ -1961,13 +1969,15 @@
|
|||
var control = this,
|
||||
renderContentArgs = arguments;
|
||||
|
||||
api.section( control.section(), function ( section ) {
|
||||
api.section( control.section(), function( section ) {
|
||||
if ( section.expanded() ) {
|
||||
api.Control.prototype.renderContent.apply( control, renderContentArgs );
|
||||
control.isRendered = true;
|
||||
} else {
|
||||
section.expanded.bind( function ( expanded ) {
|
||||
if ( expanded ) {
|
||||
section.expanded.bind( function( expanded ) {
|
||||
if ( expanded && ! control.isRendered ) {
|
||||
api.Control.prototype.renderContent.apply( control, renderContentArgs );
|
||||
control.isRendered = true;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-beta4-32118';
|
||||
$wp_version = '4.2-beta4-32119';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue