Customizer: Defer rendering theme controls until the section is displayed.

see #31793.

git-svn-id: https://develop.svn.wordpress.org/trunk@31944 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2015-03-31 22:20:13 +00:00
parent 78469b71b0
commit 5283d55271
1 changed files with 22 additions and 0 deletions

View File

@ -1859,6 +1859,28 @@
touchDrag: false, touchDrag: false,
/**
* Defer rendering the theme control until the section is displayed.
*
* @since 4.2.0
*/
renderContent: function () {
var control = this,
renderContentArgs = arguments;
api.section( control.section(), function ( section ) {
if ( section.expanded() ) {
api.Control.prototype.renderContent.apply( control, renderContentArgs );
} else {
section.expanded.bind( function ( expanded ) {
if ( expanded ) {
api.Control.prototype.renderContent.apply( control, renderContentArgs );
}
} );
}
} );
},
/** /**
* @since 4.2.0 * @since 4.2.0
*/ */