Skip to content

Promises from images never resolving in IE11 #1685

@HenryKeen

Description

@HenryKeen

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions