Skip to content

Commit 69441bd

Browse files
authored
prefetchOnHover: drop filter after querySelectorAll (#445)
This should be more efficient
1 parent 8408626 commit 69441bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/prefetch.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function viaFetch(url, hasModeCors, hasCredentials, isPriority) {
112112
export function prefetchOnHover(callback, url, onlyOnMouseover, ...args) {
113113
if (!onlyOnMouseover) return callback(url, ...args);
114114

115-
const elements = Array.from(document.querySelectorAll('a')).filter(el => el.href === url);
115+
const elements = document.querySelectorAll(`a[href="${url}"]`);
116116
const timerMap = new Map();
117117

118118
for (const el of elements) {

0 commit comments

Comments
 (0)