From 7fedf9ffe1287dd4fe90aadc4f2114a6662c09c9 Mon Sep 17 00:00:00 2001 From: bageshwar Date: Sun, 21 Oct 2012 00:29:50 +0530 Subject: [PATCH] Fixed non-required images being fetched. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Earlier all the images in were being fetched which caused a bug when generating a canvas multiple times on the sameĀ  element. Now only images inside the container element are fetched. --- src/Preload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Preload.js b/src/Preload.js index 3c76026..e892883 100644 --- a/src/Preload.js +++ b/src/Preload.js @@ -20,8 +20,8 @@ _html2canvas.Preload = function( options ) { count = 0, element = options.elements[0] || document.body, doc = element.ownerDocument, - domImages = doc.images, // TODO probably should limit it to images present in the element only - imgLen = domImages.length, + domImages = $(element).find('img'), // Find the images only inside the contained element + imgLen = domImages.length || 0, //just it case link = doc.createElement("a"), supportCORS = (function( img ){ return (img.crossOrigin !== undefined);