From a9e9d55517482de607dfd763fd44a61a423784aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20Qui=C3=B1onez?= <89791730+qmjose@users.noreply.github.com> Date: Wed, 15 Feb 2023 16:12:54 -0700 Subject: [PATCH] add validation for image source --- js/lazyload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/lazyload.js b/js/lazyload.js index 269c5b0..d9a697c 100644 --- a/js/lazyload.js +++ b/js/lazyload.js @@ -89,7 +89,7 @@ LazyLoader.prototype.load = function() { this.img.getAttribute( lazySrcAttr ); let srcset = this.img.getAttribute( lazySrcsetAttr ); // set src & serset - this.img.src = src; + if ( src ) this.img.src = src; if ( srcset ) this.img.setAttribute( 'srcset', srcset ); // remove attr this.img.removeAttribute( lazyAttr );