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:
parent
d5277df5a4
commit
5e3e74b61d
2 changed files with 11 additions and 0 deletions
5
.changeset/warm-buttons-agree.md
Normal file
5
.changeset/warm-buttons-agree.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"astro": patch
|
||||
---
|
||||
|
||||
Fixes dev toolbar warning about using the proper loading attributes on images using `data:` URIs
|
|
@ -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;
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue