Last active
June 13, 2019 14:42
-
-
Save inian/2bd3a064854fa238b4dc859acc09743e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const img = new Image(); | |
img.src = "cat.png"; | |
img.decode().then(() => { | |
// image fully decoded and can be safely rendered on the screen | |
const orig = document.getElementById("orig"); | |
orig.parentElement.replaceChild(img, orig); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Suggest to the browser that the decoding can be deferred --> | |
<img decoding="async" src="cat.png" > | |
<!-- Suggest to the browser that the decoding should not be deferred --> | |
<img decoding="sync" src="cat.png"> | |
<!-- Let the browser figure it out --> | |
<img decoding="auto" src="cat.png"> | |
<img src="cat.png"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment