diff options
author | 2023-12-05 04:14:34 -0800 | |
---|---|---|
committer | 2023-12-05 07:14:34 -0500 | |
commit | 7b6ae083482848142edc27b74fbbc318f03149d3 (patch) | |
tree | 0709f04bfd7bc1faca41bc0f565a7aa55ad0ae03 | |
parent | 30982078e666f54429fa7b6e0014c505512af024 (diff) | |
download | astro-7b6ae083482848142edc27b74fbbc318f03149d3.tar.gz astro-7b6ae083482848142edc27b74fbbc318f03149d3.tar.zst astro-7b6ae083482848142edc27b74fbbc318f03149d3.zip |
[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>
-rw-r--r-- | packages/astro/src/runtime/client/dev-overlay/plugins/audit/index.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/astro/src/runtime/client/dev-overlay/plugins/audit/index.ts b/packages/astro/src/runtime/client/dev-overlay/plugins/audit/index.ts index ac45616b1..175fe0ab6 100644 --- a/packages/astro/src/runtime/client/dev-overlay/plugins/audit/index.ts +++ b/packages/astro/src/runtime/client/dev-overlay/plugins/audit/index.ts @@ -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(); |