use test instead of match when looking for section in nav script
authorDan Allen <dan@opendevise.com>
Mon, 21 Dec 2020 00:36:13 +0000 (17:36 -0700)
committerDan Allen <dan@opendevise.com>
Mon, 21 Dec 2020 00:36:13 +0000 (17:36 -0700)
src/js/01-nav.js

index 0b4c5bf..2b66741 100644 (file)
@@ -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
           }
         }