Twenty Seventeen: Ensure functions in `customize-controls.js` don't count on Customizer sections always being present

Before, the code assumed the `theme_options` section is always present, but it can be removed by plugins. This way, if it is, no JavaScript errors occur.

Merge of [39623] to the 4.7 branch.

Props westonruter.
Fixes #39355.


Built from https://develop.svn.wordpress.org/branches/4.7@39632


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2016-12-21 05:48:34 +00:00
parent 6e8114742f
commit 7d1db9607d
2 changed files with 7 additions and 5 deletions

View File

@ -25,10 +25,12 @@
});
// Detect when the front page sections section is expanded (or closed) so we can adjust the preview accordingly.
wp.customize.section( 'theme_options' ).expanded.bind( function( isExpanding ) {
wp.customize.section( 'theme_options', function( section ) {
section.expanded.bind( function( isExpanding ) {
// Value of isExpanding will = true if you're entering the section, false if you're leaving it.
wp.customize.previewer.send( 'section-highlight', { expanded: isExpanding });
});
// Value of isExpanding will = true if you're entering the section, false if you're leaving it.
wp.customize.previewer.send( 'section-highlight', { expanded: isExpanding });
} );
} );
});
})( jQuery );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7.1-alpha-39631';
$wp_version = '4.7.1-alpha-39632';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.