Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Works around an issue where some browsers may support ProgressEvent w…

…ithout supporting the loadend event.
  • Loading branch information...
commit 4f44c8fc57967c5747fa813421a1a24422438fb0 1 parent ba90943
@dcporter dcporter authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 frameworks/ajax/system/response.js
View
7 frameworks/ajax/system/response.js
@@ -548,7 +548,12 @@ SC.XHRResponse = SC.Response.extend(
}
}
- SC.Event.add(rawRequest, 'loadend', this, this.finishRequest);
+ // Some older webkit browsers with ProgressEvent don't support loadend.
+ if (rawRequest.onloadend || rawRequest.onloadend === null) {
+ SC.Event.add(rawRequest, 'loadend', this, this.finishRequest);
+ } else {
+ SC.Event.add(rawRequest, 'readystatechange', this, this.finishRequest);
+ }
} else if (window.XMLHttpRequest && rawRequest.addEventListener) {
// XMLHttpRequest Level 1 + support for addEventListener (IE prior to version 9.0 lacks support for addEventListener)
SC.Event.add(rawRequest, 'readystatechange', this, this.finishRequest);
Please sign in to comment.
Something went wrong with that request. Please try again.