Skip to content

Commit

Permalink
use test instead of match when looking for section in nav script
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Dec 21, 2020
1 parent 6e5903c commit e5b2668
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/01-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
while ((current = current.parentNode) && current !== ceiling) {
var id = current.id
// NOTE: look for section heading
if (!id && (id = current.className.match(SECT_CLASS_RX))) id = (current.firstElementChild || {}).id
if (!id && (id = SECT_CLASS_RX.test(current.className))) id = (current.firstElementChild || {}).id
if (id && (navLink = menuPanel.querySelector('.nav-link[href="#' + id + '"]'))) break
}
}
Expand Down

0 comments on commit e5b2668

Please sign in to comment.