Skip to content

Commit 854625f

Browse files
committed
refactor: hardening the request destination type checking
by even also checking for images explicitly
1 parent 67b405c commit 854625f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

loading-attribute-polyfill.sw.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ self.addEventListener('fetch', (event) => {
1414
})
1515
);
1616
}
17-
} else if (swURLSearchparams.get('loading-images') !== 'true') {
17+
} else if (
18+
event.request.destination === 'image' &&
19+
swURLSearchparams.get('loading-images') !== 'true'
20+
) {
1821
event.respondWith(
1922
new Response(
2023
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ' +

0 commit comments

Comments
 (0)