Skip to content

Commit 5def7dd

Browse files
committed
golf: use Array.from to gather URL values;
- 886 gz / 734 br
1 parent 9056abe commit 5def7dd

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/index.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ export default function (options) {
6262
}
6363

6464
// If not, find all links and use IntersectionObserver.
65-
const linkTags = Array.from(options.el.querySelectorAll('a'));
66-
linkTags.forEach(link => observer.observe(link));
67-
const urls = linkTags.map(link => link.href);
65+
const urls = Array.from(options.el.querySelectorAll('a'), link => {
66+
observer.observe(link);
67+
return link.href;
68+
});
6869

6970
// Generate loader functions for each link
7071
urls.forEach(url => {

0 commit comments

Comments
 (0)