Skip to content

Commit

Permalink
refactor(ajax): remove code for IE7 and lower
Browse files Browse the repository at this point in the history
Since we're only supporting IE9+, we do not need to worry about the ActiveXObject stuff

BREAKING CHANGE: IE7 and lower no longer supported by ajax Observable
  • Loading branch information
benlesh committed Jan 13, 2016
1 parent 4d4fa32 commit b046fd4
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions src/observable/dom/ajax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class AjaxObservable<T> extends Observable<T> {
responseType: 'text',
timeout: 0,
createXHR: function() {
return this.crossDomain ? getCORSRequest() : getXMLHttpRequest();
return this.crossDomain ? getCORSRequest() : new root.XMLHttpRequest();
},
normalizeError: normalizeAjaxErrorEvent,
normalizeSuccess: normalizeAjaxSuccessEvent
Expand Down Expand Up @@ -225,31 +225,6 @@ export class AjaxObservable<T> extends Observable<T> {
}
}

// Gets the proper XMLHttpRequest for support for older IE
function getXMLHttpRequest() {
if (root.XMLHttpRequest) {
return new root.XMLHttpRequest();
} else {
let progId;
try {
let progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
for (let i = 0; i < 3; i++) {
try {
progId = progIds[i];
if (new root.ActiveXObject(progId)) {
break;
}
} catch (e) {
// noop
}
}
return new root.ActiveXObject(progId);
} catch (e) {
throw new Error('XMLHttpRequest is not supported by your browser');
}
}
}

// Get CORS support even for older IE
function getCORSRequest() {
let xhr = new root.XMLHttpRequest();
Expand Down

0 comments on commit b046fd4

Please sign in to comment.