From 554713bc33c0ad4d7949869188e9d047947c8e5d Mon Sep 17 00:00:00 2001 From: Imanol Eguskiza Date: Tue, 12 Jul 2022 16:57:54 +0200 Subject: [PATCH] EWPP-2422: Fix inpage navigation containers not looking for sources. --- js/inpage_navigation.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/inpage_navigation.js b/js/inpage_navigation.js index 0208235563..cefb4b68eb 100644 --- a/js/inpage_navigation.js +++ b/js/inpage_navigation.js @@ -120,6 +120,14 @@ }); }); + // The container might define its own selector so loop through those elements as well. + if (container.hasAttribute('data-inpage-navigation-source-area')) { + let selectors = container.getAttribute('data-inpage-navigation-source-area'); + Array.prototype.forEach.call(container.querySelectorAll(':scope ' + selectors), function (element) { + element.setAttribute('data-inpage-navigation-source-element', ''); + }); + } + let items_markup = ''; // Collect all the elements marked as source. Now the elements will be unique and ordered correctly. Array.prototype.forEach.call(container.querySelectorAll(':scope [data-inpage-navigation-source-element]'), function (element) {