Skip to content

Commit d43ce00

Browse files
committed
fix: Resolve issue with shadow DOM
Router should now be able to find <a> tags within open shadow DOMs.
1 parent dba70b7 commit d43ce00

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/router.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ const UPDATE = (state, url) => {
1616
return state;
1717
}
1818

19-
const link = url.target.closest('a[href]'),
19+
const elements = url.composedPath();
20+
const link = elements.find(el => el.tagName?.toLowerCase() === 'a' && el.href),
2021
href = link && link.getAttribute('href');
2122
if (
2223
!link ||

0 commit comments

Comments
 (0)