fix: only add toc eventlistener if toc exists

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson
2024-04-24 18:13:35 +02:00
parent 1fb862bcf9
commit c27e60b369

View File

@@ -1,4 +1,4 @@
const toc = document.querySelector("#TableOfContents");
const toc = document.querySelector("#TableOfContents .toc");
const headings = document.querySelectorAll("main article h2, main article h3");
if (toc) {