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

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)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Fixing IE8 support by bringing back onreadystatechange
@mzabriskie mzabriskie merged commit 3c25942 into axios:master Mar 6, 2016
@mzabriskie
Copy link
Member

Thank you for your PR!

@axios axios locked and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants