From d4b741da4816f2aac1a32ceaebdfe394878272b2 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Wed, 11 Oct 2023 20:34:26 +0100 Subject: [PATCH] global id regex --- src/js/50-cheat-sheet-toggle.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/50-cheat-sheet-toggle.js b/src/js/50-cheat-sheet-toggle.js index 9f76cf6c..6e8a858f 100644 --- a/src/js/50-cheat-sheet-toggle.js +++ b/src/js/50-cheat-sheet-toggle.js @@ -48,7 +48,6 @@ document.addEventListener('DOMContentLoaded', function () { document.location.hash = scrollToSection } document.location.replace(document.location.href.replace(document.location.search, '')) - console.log(document.location) } // check for a checkbox to display or hide labels @@ -438,9 +437,10 @@ function fixURL () { } function checkHashVariations (id) { + const dashes = /-/g const idVariants = [ id, - '_' + id.replace('-', '_'), + '_' + id.replace(dashes, '_'), ] const actualID = idVariants.filter(function (i) {