Continue render with failed svg images

This commit is contained in:
Niklas von Hertzen 2014-09-20 21:54:03 +03:00
parent 9406f76a18
commit 7ee2f411b0
4 changed files with 13 additions and 59 deletions

35
dist/html2canvas.js vendored
View File

@ -854,11 +854,6 @@ function ImageContainer(src, cors) {
if (self.image.complete === true) {
resolve(self.image);
}
})['catch'](function() {
var dummy = new DummyImageContainer(src);
return dummy.promise.then(function(image) {
self.image = image;
});
});
}
@ -958,7 +953,12 @@ ImageLoader.prototype.isSameOrigin = function(url) {
};
ImageLoader.prototype.getPromise = function(container) {
return container.promise;
return container.promise['catch'](function() {
var dummy = new DummyImageContainer(container.src);
return dummy.promise.then(function(image) {
container.image = image;
});
});
};
ImageLoader.prototype.get = function(src) {
@ -982,29 +982,6 @@ ImageLoader.prototype.fetch = function(nodes) {
return this;
};
function isImage(container) {
return container.node.nodeName === "IMG";
}
function isSVGNode(container) {
return container.node.nodeName === "svg";
}
function urlImage(container) {
return {
args: [container.node.src],
method: "url"
};
}
function svgImage(container) {
return {
args: [container.node],
method: "svg"
};
}
function LinearGradientContainer(imageData) {
GradientContainer.apply(this, arguments);
this.type = this.TYPES.LINEAR;

File diff suppressed because one or more lines are too long

View File

@ -13,10 +13,5 @@ function ImageContainer(src, cors) {
if (self.image.complete === true) {
resolve(self.image);
}
})['catch'](function() {
var dummy = new DummyImageContainer(src);
return dummy.promise.then(function(image) {
self.image = image;
});
});
}

View File

@ -94,7 +94,12 @@ ImageLoader.prototype.isSameOrigin = function(url) {
};
ImageLoader.prototype.getPromise = function(container) {
return container.promise;
return container.promise['catch'](function() {
var dummy = new DummyImageContainer(container.src);
return dummy.promise.then(function(image) {
container.image = image;
});
});
};
ImageLoader.prototype.get = function(src) {
@ -117,26 +122,3 @@ ImageLoader.prototype.fetch = function(nodes) {
log("Finished searching images");
return this;
};
function isImage(container) {
return container.node.nodeName === "IMG";
}
function isSVGNode(container) {
return container.node.nodeName === "svg";
}
function urlImage(container) {
return {
args: [container.node.src],
method: "url"
};
}
function svgImage(container) {
return {
args: [container.node],
method: "svg"
};
}