Promises from images never resolving in IE11
See original GitHub issueI have a chart with a watermark configured, the image is configured in the layout so that it is rendered in the g.layer-above g.imagelayer
div. The image loads and renders fine. The problem is that the promise returned from the newPlot
function never resolves when using IE11.
plotly.newPlot(elem).then(function(){
//never hit
});
I’ve narrowed it down to this line where the load
event never fires:
I expect doing something like this is what was intended:
img.onerror = errorHandler;
img.onload = function() {
var canvas = document.createElement('canvas');
canvas.width = this.width;
canvas.height = this.height;
var ctx = canvas.getContext('2d');
ctx.drawImage(this, 0, 0);
var dataURL = canvas.toDataURL('image/png');
thisImage.attr('xlink:href', dataURL);
resolve(); //Resolve here instead after setting the data url
};
thisImage.on('error', errorHandler);
img.src = d.source;
Would you be willing to accept a pull request?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
How to support promises in Internet Explorer 11?
IE11 neither supports arrow functions nor native Promises. Use a JS transpiler (like babel) or don't use ES6 features. For Promise support you...
Read more >Fix site display issues with Compatibility View in Internet ...
Learn how to fix website display problems using Compatibility View in Internet Explorer.
Read more >Handling common JavaScript problems - MDN Web Docs
Note: The easiest solution is to declare the iteration variable with let instead of var —the value of i associated with the function...
Read more >Promises In JavaScript - Medium
return new Promise(resolve => setTimeout(() => resolve(arg1 + 1)); ... IE11 does not support this object, so you should use a polyfill like...
Read more >IE11 and the Missing Polyfills - DEV Community
there is no way to automatically detect which parts are missing . Well, that's not clearly visible from the image, but is true....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hi @etpinard I have a pull request to my own fork. Do you mind giving it a review?
fixed in https://github.com/plotly/plotly.js/pull/1691