Opened 8 months ago
Last modified 7 months ago
#22307 closed defect (bug)
Twenty Twelve: JavaScript error if not removed navigation wrapper markup — at Version 5
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Bundled Theme | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | xoodrew@… |
Description (last modified by lancewillett)
I'm getting this error on a page that isn't using the header or nav. [Edit by lancewillett: This only occurs when the entire nav markup is removed.]
Error: TypeError: document.getElementById("site-navigation") is null
Source File: /wp-content/themes/twentytwelve/js/navigation.js?ver=1.0
Line: 7
Can a check be added into the Twenty Twelve theme to make sure #site-navigation exists on the page?
Change History (6)
comment:1
SergeyBiryukov
— 8 months ago
- Component changed from Themes to Bundled Theme
- Milestone changed from Awaiting Review to 3.5
comment:2
DrewAPicture
— 8 months ago
- Summary changed from Javascript error in 2012 theme if not using nav to Twenty Twelve: Javascript error if not using nav
comment:3
lancewillett
— 8 months ago
- Keywords needs-testing added
comment:4
sswells
— 8 months ago
- I'm using FireFox on Mac OS X Lion
- Twenty Twelve is Version 1.0. These are the only two instances of 'site-navigation' I can find in the theme.
(twentytwelve/js/navigation.js)
var button = document.getElementById( 'site-navigation' ).getElementsByTagName( 'h3' )[0],
menu = document.getElementById( 'site-navigation' ).getElementsByTagName( 'ul' )[0];
comment:5
lancewillett
— 8 months ago
- Description modified (diff)
- Keywords needs-patch added; needs-testing removed
- Summary changed from Twenty Twelve: Javascript error if not using nav to Twenty Twelve: JavaScript error if not removed navigation wrapper markup
I was able to repeat, but only when removing the entire navigation markup -- not just without a navigation menu since that case was already heavily tested and accounted for.
Hi sswells -- could you please tell us:
The navigation JS file already has a check in place, so it'd be good to try and repeat this with your exact setup.