question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Promises from images never resolving in IE11

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
HenryKeencommented, May 16, 2017

hi @etpinard I have a pull request to my own fork. Do you mind giving it a review?

0reactions
etpinardcommented, May 16, 2017
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found