From 7ee7d7fa67474c9473333e3f78c7611adf02a7b5 Mon Sep 17 00:00:00 2001 From: Guido Tapia Date: Tue, 15 Nov 2011 16:07:05 +1100 Subject: [PATCH] It is possible for image tags not to have a 'src' (or background-image) attribute specified. This case currently crashes html2canvas. I know its an edge case but it bit me. I set the image src programatically much later (element is actually not visible at the time I call html2canvas). --- src/Preload.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Preload.js b/src/Preload.js index 1465b25..3cbca76 100644 --- a/src/Preload.js +++ b/src/Preload.js @@ -250,7 +250,10 @@ html2canvas.Preload = function(element, opts){ // load images for (i = 0; i < imgLen; i+=1){ - methods.loadImage( domImages[i].getAttribute( "src" ) ); + var imgSrc = domImages[i].getAttribute( "src" ); + if ( imgSrc ) { + methods.loadImage( imgSrc ); + } } // remove 'start'