Feature request: Enable using `updatePageLinks` on arbitrary elements (not just `document`).
ejez opened this issue · 1 comments
Thanks for the work on this library.
Just started exploring navigo, and found how data-navigo
and updatePageLinks
can greatly simplify adding internal app links. However they become useless when the app is using web components, because querying for the links is hardcoded to document.querySelectorAll
which does not traverse the shadow dom.
I suggest adding an optional argument element
(with document
as default) to the functions findLinks
and updatePageLinks
. This argument will be the subject element where the links are searched for. (element.querySelectorAll
instead of document.querySelectorAll
.)
This simple change will allow for more flexible use of this functionality. Web components are increasingly being adopted.
Another option is to make use of https://github.com/Georgegriff/query-selector-shadow-dom to allow traversing all the shadow doms, even if they are deeply nested.
Thank you in advance.
how do I use updatePageLinks?