Twenty Seventeen: Fix broken menu toggle in Customizer after menu items are added

This simplifies the line `$( siteNavigation.closest( '.main-navigation' ), this ).toggleClass( 'toggled-on' );` to `$( siteNavContain ).toggleClass( 'toggled-on' );`, since `this` is the clicked button, so the extra context isn't needed.

Props afercia, laurelfulford.

Fixes #38992.

Built from https://develop.svn.wordpress.org/trunk@39419


git-svn-id: http://core.svn.wordpress.org/trunk@39359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
David A. Kennedy 2016-12-02 06:25:42 +00:00
parent 68fd3f7989
commit c0a9b1e57f
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,7 @@
*/ */
(function( $ ) { (function( $ ) {
var masthead, menuToggle, siteNavigation; var masthead, menuToggle, siteNavContain, siteNavigation;
function initMainNavigation( container ) { function initMainNavigation( container ) {
@ -39,6 +39,7 @@
masthead = $( '#masthead' ); masthead = $( '#masthead' );
menuToggle = masthead.find( '.menu-toggle' ); menuToggle = masthead.find( '.menu-toggle' );
siteNavContain = masthead.find( '.main-navigation' );
siteNavigation = masthead.find( '.main-navigation > div > ul' ); siteNavigation = masthead.find( '.main-navigation > div > ul' );
// Enable menuToggle. // Enable menuToggle.
@ -53,7 +54,7 @@
menuToggle.add( siteNavigation ).attr( 'aria-expanded', 'false' ); menuToggle.add( siteNavigation ).attr( 'aria-expanded', 'false' );
menuToggle.on( 'click.twentyseventeen', function() { menuToggle.on( 'click.twentyseventeen', function() {
$( siteNavigation.closest( '.main-navigation' ), this ).toggleClass( 'toggled-on' ); $( siteNavContain ).toggleClass( 'toggled-on' );
$( this ) $( this )
.add( siteNavigation ) .add( siteNavigation )

View File

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