From ca7fe6b644dd7b978bd647cc013ba609a1e8e713 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Thu, 20 Jan 2022 10:53:40 -0500 Subject: [PATCH] DEV: Fix tag name matching (#26) --- javascripts/discourse/initializers/disco-toc-main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/javascripts/discourse/initializers/disco-toc-main.js b/javascripts/discourse/initializers/disco-toc-main.js index 777dbd1..3594ead 100644 --- a/javascripts/discourse/initializers/disco-toc-main.js +++ b/javascripts/discourse/initializers/disco-toc-main.js @@ -240,7 +240,7 @@ export default { headings.forEach((heading, subIndex) => { if (subIndex > currentIndex && subIndex < nextIndex) { let subUl = li.lastChild; - if (subUl.tagName !== "ul") { + if (subUl.tagName !== "UL") { subUl = subUl.appendChild(document.createElement("ul")); subUl.classList.add("d-toc-sublevel"); li.appendChild(subUl); @@ -259,6 +259,7 @@ export default { buildItem(node) { let clonedNode = node.cloneNode(true); + clonedNode.querySelector("span.clicks")?.remove(); const li = document.createElement("li"); li.classList.add("d-toc-item");