mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fixed non-required images being fetched.
Earlier all the images in <body> 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.
This commit is contained in:
@@ -20,8 +20,8 @@ _html2canvas.Preload = function( options ) {
|
|||||||
count = 0,
|
count = 0,
|
||||||
element = options.elements[0] || document.body,
|
element = options.elements[0] || document.body,
|
||||||
doc = element.ownerDocument,
|
doc = element.ownerDocument,
|
||||||
domImages = doc.images, // TODO probably should limit it to images present in the element only
|
domImages = $(element).find('img'), // Find the images only inside the contained element
|
||||||
imgLen = domImages.length,
|
imgLen = domImages.length || 0, //just it case
|
||||||
link = doc.createElement("a"),
|
link = doc.createElement("a"),
|
||||||
supportCORS = (function( img ){
|
supportCORS = (function( img ){
|
||||||
return (img.crossOrigin !== undefined);
|
return (img.crossOrigin !== undefined);
|
||||||
|
|||||||
Reference in New Issue
Block a user