TOC: Prepare for upstream change to mw:tocplace element
Bug: T311502 Change-Id: I1f607cf1ef1b61fb4d2e1880de756fb94d5a6b22
This commit is contained in:
parent
6cd7098d05
commit
6df60895ab
|
@ -15,7 +15,7 @@ const
|
|||
BODY_CONTENT_ID = 'bodyContent',
|
||||
HEADLINE_SELECTOR = '.mw-headline',
|
||||
TOC_SECTION_ID_PREFIX = 'toc-',
|
||||
TOC_LEGACY_PLACEHOLDER_TAG = 'mw:tocplace',
|
||||
TOC_LEGACY_PLACEHOLDER_SELECTOR = 'mw:tocplace,meta[property="mw:PageProp/toc"]',
|
||||
TOC_SCROLL_HOOK = 'table_of_contents',
|
||||
TOC_COLLAPSED_CLASS = 'vector-toc-collapsed',
|
||||
PAGE_TITLE_SCROLL_HOOK = 'page_title',
|
||||
|
@ -214,7 +214,7 @@ const main = () => {
|
|||
|
||||
// Setup intersection observer for TOC scroll event tracking
|
||||
// fire hooks for event logging if AB tests are enabled
|
||||
const tocLegacyPlaceholder = document.getElementsByTagName( TOC_LEGACY_PLACEHOLDER_TAG )[ 0 ];
|
||||
const tocLegacyPlaceholder = document.querySelectorAll( TOC_LEGACY_PLACEHOLDER_SELECTOR )[ 0 ];
|
||||
const tocLegacyTargetIntersection = tocElementLegacy || tocLegacyPlaceholder;
|
||||
// Initiate observer for table of contents in main content.
|
||||
if ( tocLegacyTargetIntersection ) {
|
||||
|
|
Loading…
Reference in New Issue