Last active
December 2, 2020 17:25
-
-
Save jrswgtr/8e6a490a26e9188aa034e3454cb8a7f7 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
export default class ImageLoader | |
{ | |
load( element ) | |
{ | |
if ( !element.hasAttribute( "data-src" ) ) { | |
return; | |
} | |
const src = element.getAttribute( "data-src" ); | |
element.removeAttribute( "data-src" ); | |
element.setAttribute( "src", src ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment