does't work in IE11 with ES6. Unable to get property 'svg' of undefined or null reference
See original GitHub issueit doesn’t work in IE11 with ES6.
import html2canvas from "html2canvas"; return html2canvas(node, { allowTaint: true }).then((canvas) => { return Promise.resolve(canvas.toDataURL()); });
Unhandled rejection TypeError: Unable to get property ‘svg’ of undefined or null reference at SVGContainer.prototype.hasFabric at SVGNodeContainer at ImageLoader.prototype.loadImage at Anonymous function at Anonymous function at ImageLoader.prototype.findImages at ImageLoader.prototype.fetch at NodeParser at renderWindow at Anonymous function
function Support(document) { this.rangeBounds = this.testRangeBounds(document); this.cors = this.testCORS(); this.svg = this.testSVG(); }
I found it was broken by the property of ‘svg’, this value is judge whether canvas can draw the image of SVG. In IE11, it always return false.
` function SVGNodeContainer(node, _native) { this.src = node; this.image = null; var self = this;
this.promise = _native ? new Promise(function(resolve, reject) {
self.image = new Image();
self.image.onload = resolve;
self.image.onerror = reject;
self.image.src = "data:image/svg+xml," + (new XMLSerializer()).serializeToString(node);
if (self.image.complete === true) {
resolve(self.image);
}
}) : this.hasFabric().then(function() {
return new Promise(function(resolve) {
window.html2canvas.svg.fabric.parseSVGDocument(node, self.createCanvas.call(self, resolve));
});
});
} `
**as the ‘_native’ from ‘this.svg’ is false, then go through the this.hasFabric and window.html2canvas.svg which are ‘undefined’, I don’t know why.
when I change this.svg = true, it can work. Thus, could you help resolve it or set the ‘svg’ to higher level so that I can change this value and its behavior?**
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top GitHub Comments
Sure. Doc is attached. loading html2canvas js files - options.pdf
@kgcroteau could you include the doc or the information here too? I’m having the same issue