From d3d94955a5ee36e9e13683bd2e50128700a3238e Mon Sep 17 00:00:00 2001 From: Lin Junjie Date: Thu, 31 May 2012 18:17:50 +0800 Subject: [PATCH] Fixes bug where img elements without the realSrcAttribute go missing in Firefox --- Source/LazyLoad.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) mode change 100644 => 100755 Source/LazyLoad.js diff --git a/Source/LazyLoad.js b/Source/LazyLoad.js old mode 100644 new mode 100755 index 73ae7dd..9a5dff1 --- a/Source/LazyLoad.js +++ b/Source/LazyLoad.js @@ -104,15 +104,19 @@ var LazyLoad = new Class({ this.container.addEvent("scroll", action); }, loadImage: function(image) { - // Set load event for fadeIn - if(this.options.useFade) { - image.addEvent("load", function(){ - image.fade(1); - }); + var realSrc = image.get(this.options.realSrcAttribute); + + if (realSrc !== null) { + // Set load event for fadeIn + if(this.options.useFade) { + image.addEvent("load", function(){ + image.fade(1); + }); + } + + image.set("src", realSrc); + // Fire the image load event + this.fireEvent("load", [image]); } - // Set the SRC - image.set("src", image.get(this.options.realSrcAttribute)); - // Fire the image load event - this.fireEvent("load", [image]); } }); \ No newline at end of file