mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-24 15:53:46 +00:00
Merge "Add check for activeTopSection in activateSection"
This commit is contained in:
commit
dcce19c56f
|
@ -132,9 +132,12 @@ module.exports = function tableOfContents( props ) {
|
|||
}
|
||||
|
||||
// Assign the active top and sub sections, apply classes
|
||||
activeTopSection = /** @type {HTMLElement} */ ( selectedTocSection.closest( `.${TOP_SECTION_CLASS}` ) );
|
||||
activeTopSection = /** @type {HTMLElement|undefined} */ ( selectedTocSection.closest( `.${TOP_SECTION_CLASS}` ) );
|
||||
if ( activeTopSection ) {
|
||||
// T328089 Sometimes activeTopSection is null
|
||||
activeTopSection.classList.add( ACTIVE_TOP_SECTION_CLASS );
|
||||
}
|
||||
activeSubSection = selectedTocSection;
|
||||
activeTopSection.classList.add( ACTIVE_TOP_SECTION_CLASS );
|
||||
activeSubSection.classList.add( ACTIVE_SECTION_CLASS );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue