Skip to content

Commit 831f523

Browse files
committed
Meta: Fix TOC auto-expansion
1 parent 3e73588 commit 831f523

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spec.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
// There aren't many headings, so just expand them all by default.
1313
document.addEventListener("DOMContentLoaded", function() {
1414
try {
15-
document.querySelectorAll("#menu-toc li").forEach(el => el.click());
15+
const menuItems = Array.from(document.querySelectorAll("#menu-toc li"));
16+
if (!menuItems.some(el => el.classList.has("active"))) {
17+
menuItems.forEach(el => el.classList.add("active"));
18+
}
1619
} catch (ex) {}
1720
});
1821
</script>

0 commit comments

Comments
 (0)