mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
[Toolbar] Remove image decode call (#9305)
* stop waiting for images to decode * fix: don't add empty audits --------- Co-authored-by: Princesseuh <3019731+Princesseuh@users.noreply.github.com>
This commit is contained in:
parent
30982078e6
commit
7b6ae08348
1 changed files with 4 additions and 4 deletions
|
@ -135,7 +135,7 @@ export default {
|
|||
margin: 0;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
|
||||
astro-dev-toolbar-icon {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
|
@ -187,13 +187,13 @@ export default {
|
|||
|
||||
// If the element is hidden, don't do anything
|
||||
if (targetedElement.offsetParent === null || computedStyle.display === 'none') {
|
||||
audits.push();
|
||||
return;
|
||||
}
|
||||
|
||||
// If the element is an image, wait for it to load
|
||||
// If the element is an image but not yet loaded, ignore it
|
||||
// TODO: We shouldn't ignore this, because it is valid for an image to not be loaded at start (e.g. lazy loading)
|
||||
if (originalElement.nodeName === 'IMG' && !(originalElement as HTMLImageElement).complete) {
|
||||
await (originalElement as HTMLImageElement).decode();
|
||||
return;
|
||||
}
|
||||
|
||||
const rect = originalElement.getBoundingClientRect();
|
||||
|
|
Loading…
Add table
Reference in a new issue