add o_deepest_active_toc_entry class on deepest active <li>

This commit is contained in:
Antoine Vandevenne (anv) 2021-02-26 11:06:05 +01:00
parent 72278a1210
commit bd4a433124

View File

@ -16,8 +16,9 @@
* *
* TOC entries (<li> elements) that are on the path of the displayed page receive the * TOC entries (<li> elements) that are on the path of the displayed page receive the
* `o_active_toc_entry` class, and their related (parent) TOC entry list (<ul> elements) receive * `o_active_toc_entry` class, and their related (parent) TOC entry list (<ul> elements) receive
* the `show` (Bootstrap) class. The child TOC entry list of the deepest TOC entry also * the `show` (Bootstrap) class.
* receives the `show` class. * Also, the deepest TOC entry receives the `o_deepest_active_toc_entry` class, and its child
* TOC entry list receives the `show` class.
*/ */
const _flagActiveTocEntriesAndLists = () => { const _flagActiveTocEntriesAndLists = () => {
let deepestTocEntry = undefined; let deepestTocEntry = undefined;
@ -32,6 +33,7 @@
} }
}) })
if (deepestTocEntry) { if (deepestTocEntry) {
deepestTocEntry.classList.add('o_deepest_active_toc_entry');
const childTocEntryList = deepestTocEntry.querySelector('ul'); const childTocEntryList = deepestTocEntry.querySelector('ul');
if (childTocEntryList) { if (childTocEntryList) {
childTocEntryList.classList.add('show'); childTocEntryList.classList.add('show');