Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified demos/basic.html
Binary file not shown.
6 changes: 6 additions & 0 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ export default function (options) {
// If not, find all links and use IntersectionObserver.
Array.from(options.el.querySelectorAll('a'), link => {
observer.observe(link);

// Do not need when link is just URL fragment of same page.
if (link.hostname === location.hostname && link.pathname === location.pathname) {
return;
}

// If the anchor matches a permitted origin
// ~> A `[]` or `true` means everything is allowed
if (!allowed.length || allowed.includes(link.hostname)) {
Expand Down