Skip to content

Commit e5dbedb

Browse files
author
JoelCDL
committed
Only query subnav elements if headernav is present
1 parent 1680c92 commit e5dbedb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/js/headernav.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import { popoverSupport } from './popover-support'
44
const headerNav = document.querySelector('.js-headernav')
5-
const subNavs = headerNav.querySelectorAll(':scope > ul > li:has(> ul)')
65
const headerNavMediaQuery = window.matchMedia('(min-width: 760px)')
76

87
if (headerNav && popoverSupport()) {
8+
const subNavs = headerNav.querySelectorAll(':scope > ul > li:has(> ul)')
99
for (const subNav of subNavs) {
1010
const subNavLink = subNav.querySelector('a')
1111
const subNavPopover = subNav.querySelector('ul')

0 commit comments

Comments
 (0)