Created
June 22, 2022 20:43
-
-
Save sandeep1995/cd7b96aeea7c55d792c8365c893571d5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// add loading="lazy" for all images | |
const images = dom.window.document.querySelectorAll('img[src]'); | |
Array.prototype.forEach.call(images, (img) => { | |
img.setAttribute('loading', 'lazy'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment