From 4a8da384d21cdb29a731938b9a4c52c6bd04bf4a Mon Sep 17 00:00:00 2001 From: Ochen K Date: Wed, 28 Aug 2019 19:15:25 -0500 Subject: [PATCH] =?UTF-8?q?Excluding=20=E2=80=9C:not()=E2=80=9D=20pseudo?= =?UTF-8?q?=20classes=20from=20toc=20list=20item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 18844f3..70baeb7 100644 --- a/index.js +++ b/index.js @@ -29,7 +29,7 @@ function init(el) { const index = item.id || `toc-${i++}`; const text = item.dataset.tocTitle ? item.dataset.tocTitle.trim() : item.textContent.trim(); - const sanitizedClassName = selector.replace(/((:+[\w-\d]*)|[^A-z0-9-\s])/g, ' ').replace(/\s{2,}/g, ' ').trim(); + const sanitizedClassName = selector.replace(/(:not\([.a-zA-Z0-9-_]+\))/g, '').replace(/((:+[\w-\d]*)|[^A-z0-9-\s])/g, ' ').replace(/\s{2,}/g, ' ').trim(); const className = `toc-${sanitizedClassName}`; // Set it if none