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
* `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
* receives the `show` class.
* the `show` (Bootstrap) 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 = () => {
let deepestTocEntry = undefined;
@ -32,6 +33,7 @@
}
})
if (deepestTocEntry) {
deepestTocEntry.classList.add('o_deepest_active_toc_entry');
const childTocEntryList = deepestTocEntry.querySelector('ul');
if (childTocEntryList) {
childTocEntryList.classList.add('show');