From fdd26598c1a09e9aeb8423e9a6ce3ecb0afe914f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rouven=20We=C3=9Fling?= Date: Fri, 26 Sep 2014 16:01:54 +0200 Subject: [PATCH] refactor($http) Simplify code by removing workarounds for older versions of Internet Explorer This removes a workaround for IE 8 and and error handling for IE6. --- docs/content/error/$httpBackend/noxhr.ngdoc | 10 ---------- src/ng/httpBackend.js | 16 +++------------- 2 files changed, 3 insertions(+), 23 deletions(-) delete mode 100644 docs/content/error/$httpBackend/noxhr.ngdoc diff --git a/docs/content/error/$httpBackend/noxhr.ngdoc b/docs/content/error/$httpBackend/noxhr.ngdoc deleted file mode 100644 index e2d5901d72ea..000000000000 --- a/docs/content/error/$httpBackend/noxhr.ngdoc +++ /dev/null @@ -1,10 +0,0 @@ -@ngdoc error -@name $httpBackend:noxhr -@fullName Unsupported XHR -@description - -This error occurs in browsers that do not support XmlHttpRequest. AngularJS -supports Safari, Chrome, Firefox, Opera, IE8 and higher, and mobile browsers -(Android, Chrome Mobile, iOS Safari). To avoid this error, use an officially -supported browser. - diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 78d04cfa24b9..c29e5bfc23e8 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -1,17 +1,7 @@ 'use strict'; -function createXhr(method) { - //if IE and the method is not RFC2616 compliant, or if XMLHttpRequest - //is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest - //if it is available - if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) || - !window.XMLHttpRequest)) { - return new window.ActiveXObject("Microsoft.XMLHTTP"); - } else if (window.XMLHttpRequest) { - return new window.XMLHttpRequest(); - } - - throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest."); +function createXhr() { + return new window.XMLHttpRequest(); } /** @@ -59,7 +49,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc }); } else { - var xhr = createXhr(method); + var xhr = createXhr(); xhr.open(method, url, true); forEach(headers, function(value, key) {