Skip to content

Resolve the promise after the first image loads#1

Open
HenryKeen wants to merge 4 commits into
masterfrom
ie11-image-promise-fix
Open

Resolve the promise after the first image loads#1
HenryKeen wants to merge 4 commits into
masterfrom
ie11-image-promise-fix

Conversation

@HenryKeen
Copy link
Copy Markdown
Owner

@HenryKeen HenryKeen commented May 16, 2017

Fixes plotly#1685

As there is no test runner for IE11 the test is just to give coverage for other browsers. A manual test has asserted that has fixed the problem in IE11.

@HenryKeen HenryKeen added the bug label May 16, 2017
var dataURL = canvas.toDataURL('image/png');

thisImage.attr('xlink:href', dataURL);
resolve();
Copy link
Copy Markdown

@etpinard etpinard May 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Could you add a comment above to make sure we remember why that resolve is there? Something like:

// resolve promise in onload handler instead of on 'load' to support IE11
// see https://github.com/plotly/plotly.js/issues/1685 
// for more details
resolve();

Comment thread test/jasmine/tests/plot_api_test.js Outdated
.then(done);
});

it('accepts images in layout which it renders', function(done) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to for this. We already have a full suite of layout.images tests in:

https://github.com/plotly/plotly.js/blob/master/test/jasmine/tests/layout_images_test.js


We don't currently run any CI test on IE unfortunately, so yeah, your patch won't be supported by any tests at the moment 😞 .

We did try to get an Appveyor CI box running (see plotly#431) but that effort came up short.

@etpinard
Copy link
Copy Markdown

Thanks very much @HenryKeen ! PR away once my two small comments are addressed 🚀

@HenryKeen
Copy link
Copy Markdown
Owner Author

Great stuff! Thanks @etpinard. PR submitted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promises from images never resolving in IE11

2 participants