Skip to content

Commit

Permalink
fix: blank image in safari, algin #461, #478
Browse files Browse the repository at this point in the history
  • Loading branch information
ywenhao committed Feb 18, 2025
1 parent 9957281 commit 4406abc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/embed-images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ async function embedImageNode<T extends HTMLElement | SVGImageElement>(

const image = clonedNode as HTMLImageElement
if (image.decode) {
image.decode = resolve as any
image.onload = () => {
image.decode().then(() => {
requestAnimationFrame(resolve)
})
}

Check warning on line 74 in src/embed-images.ts

View check run for this annotation

Codecov / codecov/patch

src/embed-images.ts#L74

Added line #L74 was not covered by tests
image.decoding = 'sync'
}

if (image.loading === 'lazy') {
Expand Down

0 comments on commit 4406abc

Please sign in to comment.