0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-17 22:44:24 -05:00

fix(audits): Don't warn about loading on data URIs (#10275)

This commit is contained in:
Erika 2024-03-01 11:41:43 +01:00 committed by GitHub
parent d5277df5a4
commit 5e3e74b61d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Fixes dev toolbar warning about using the proper loading attributes on images using `data:` URIs

View file

@ -38,6 +38,9 @@ export const perf: AuditRuleWithSelector[] = [
// Ignore elements that are above the fold, they should be loaded eagerly
if (htmlElement.offsetTop < window.innerHeight) return false;
// Ignore elements using `data:` URI, the `loading` attribute doesn't do anything for these
if (htmlElement.src.startsWith('data:')) return false;
return true;
},
},
@ -53,6 +56,9 @@ export const perf: AuditRuleWithSelector[] = [
// Ignore elements that are below the fold, they should be loaded lazily
if (htmlElement.offsetTop > window.innerHeight) return false;
// Ignore elements using `data:` URI, the `loading` attribute doesn't do anything for these
if (htmlElement.src.startsWith('data:')) return false;
return true;
},
},