Mark active sections even when their headings are in wrapper elements

This partially reverts 94c7f31082.
Headings inside wrapper divs etc. actually are rendered in the table
of contents.

Bug: T318044
Bug: T324869
Change-Id: Ie3181d9e9605cd2b5897b12931572057e80d6661
This commit is contained in:
Bartosz Dziewoński 2022-12-13 23:11:32 +01:00
parent f597c53f74
commit f6c85143c6

View file

@ -287,7 +287,7 @@ const main = () => {
} ); } );
const headingSelector = [ const headingSelector = [
'h1', 'h2', 'h3', 'h4', 'h5', 'h6' 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
].map( ( tag ) => `.mw-parser-output > ${tag}` ).join( ',' ); ].map( ( tag ) => `.mw-parser-output ${tag}` ).join( ',' );
const sectionObserver = initSectionObserver( { const sectionObserver = initSectionObserver( {
elements: bodyContent.querySelectorAll( `${headingSelector}, .mw-body-content` ), elements: bodyContent.querySelectorAll( `${headingSelector}, .mw-body-content` ),
topMargin: header ? header.getBoundingClientRect().height : 0, topMargin: header ? header.getBoundingClientRect().height : 0,