Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing IE8 support by bringing back onreadystatechange #249

Merged
merged 1 commit into from Mar 6, 2016

Conversation

@ctimmerm
Copy link
Contributor

commented Feb 25, 2016

Bringing back onreadystatechange is a little tricky, since it's also called for requests that errored out.
As far as I can see, and after testing it in a few browsers, checking for request.status === 0 is a decent way to know that no real response was received and onerror will be called.

I've also removed the use of Array.prototype.indexOf since that's not available in IE8.

request.onload = function handleLoad() {
if (!request) {
request[loadEvent] = function handleLoad() {
if (!request || (request.readyState !== 4 && !xDomain)) {

This comment has been minimized.

Copy link
@nettofarah

nettofarah Feb 28, 2016

Contributor

Maybe we could extract (request.readyState !== 4 && !xDomain) into an explaining variable so it would be easier for people reading the code that understand what this condition is about.

I'm not sure what this does tbh. what does (request.readyState !== 4 && !xDomain) mean?

mzabriskie added a commit that referenced this pull request Mar 6, 2016

Merge pull request #249 from ctimmerm/ie8-onreadystatechange
Fixing IE8 support by bringing back onreadystatechange

@mzabriskie mzabriskie merged commit 3c25942 into axios:master Mar 6, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@mzabriskie

This comment has been minimized.

Copy link
Member

commented Mar 6, 2016

Thank you for your PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.