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. Props westonruter. Fixes #39335. git-svn-id: https://develop.svn.wordpress.org/trunk@39623 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
460c358859
commit
87ed10d7ec
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user