Twenty Twelve: avoid JavaScript errors if navigation wrapper markup is removed from header. Fixes #22307.
git-svn-id: https://develop.svn.wordpress.org/trunk@22574 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
83d6afd2fb
commit
915b3eda40
@ -4,16 +4,18 @@
|
||||
* Handles toggling the navigation menu for small screens.
|
||||
*/
|
||||
( function() {
|
||||
var button = document.getElementById( 'site-navigation' ).getElementsByTagName( 'h3' )[0],
|
||||
menu = document.getElementById( 'site-navigation' ).getElementsByTagName( 'ul' )[0];
|
||||
|
||||
if ( undefined === button )
|
||||
return false;
|
||||
var nav = document.getElementById( 'site-navigation' ), button, menu;
|
||||
if ( ! nav )
|
||||
return;
|
||||
button = nav.getElementsByTagName( 'h3' )[0];
|
||||
menu = nav.getElementsByTagName( 'ul' )[0];
|
||||
if ( ! button )
|
||||
return;
|
||||
|
||||
// Hide button if menu is missing or empty.
|
||||
if ( undefined === menu || ! menu.childNodes.length ) {
|
||||
if ( ! menu || ! menu.childNodes.length ) {
|
||||
button.style.display = 'none';
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
button.onclick = function() {
|
||||
|
Loading…
Reference in New Issue
Block a user