From e8d388891dd9f1ee908fcd3026b3757738d4b421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rouven=20We=C3=9Fling?= Date: Wed, 22 Jul 2015 21:41:00 +0200 Subject: [PATCH] refactor(): Remove more bits and pieces related to Internet Explorer 8 --- src/ng/httpBackend.js | 2 +- src/ng/location.js | 2 +- src/ng/urlUtils.js | 9 +-------- test/ng/httpBackendSpec.js | 2 +- test/ng/sceSpecs.js | 6 ------ test/ngMock/angular-mocksSpec.js | 6 ------ test/ngRoute/directive/ngViewSpec.js | 3 +-- 7 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 8bfd85516807..91fbb7fb7e16 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -58,7 +58,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc xhr.onload = function requestLoaded() { var statusText = xhr.statusText || ''; - // responseText is the old-school way of retrieving response (supported by IE8 & 9) + // responseText is the old-school way of retrieving response (supported by IE9) // response/responseType properties were introduced in XHR Level2 spec (supported by IE10) var response = ('response' in xhr) ? xhr.response : xhr.responseText; diff --git a/src/ng/location.js b/src/ng/location.js index 3ff165a50754..0412f3d9183f 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -316,7 +316,7 @@ function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) { hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; - // include hashPrefix in $$absUrl when $$url is empty so IE8 & 9 do not reload page because of removal of '#' + // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#' this.$$absUrl = appBase + hashPrefix + this.$$url; }; diff --git a/src/ng/urlUtils.js b/src/ng/urlUtils.js index f718ada6ccaa..9f672e8d3658 100644 --- a/src/ng/urlUtils.js +++ b/src/ng/urlUtils.js @@ -24,20 +24,13 @@ var originUrl = urlResolve(window.location.href); * * Implementation Notes for IE * --------------------------- - * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other + * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other * browsers. However, the parsed components will not be set if the URL assigned did not specify * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We * work around that by performing the parsing in a 2nd step by taking a previously normalized * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the * properties such as protocol, hostname, port, etc. * - * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one - * uses the inner HTML approach to assign the URL as part of an HTML snippet - - * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL. - * Unfortunately, setting img[src] to something like "javascript:foo" on IE throws an exception. - * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that - * method and IE < 8 is unsupported. - * * References: * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html diff --git a/test/ng/httpBackendSpec.js b/test/ng/httpBackendSpec.js index abe40d176bff..bd7f4b8f1859 100644 --- a/test/ng/httpBackendSpec.js +++ b/test/ng/httpBackendSpec.js @@ -252,7 +252,7 @@ describe('$httpBackend', function() { it('should read responseText if response was not defined', function() { - // old browsers like IE8, don't support responseType, so they always respond with responseText + // old browsers like IE9, don't support responseType, so they always respond with responseText $backend('GET', '/whatever', null, callback, {}, null, null, 'blob'); diff --git a/test/ng/sceSpecs.js b/test/ng/sceSpecs.js index 11006744d18f..a35f6f3d83b7 100644 --- a/test/ng/sceSpecs.js +++ b/test/ng/sceSpecs.js @@ -2,12 +2,6 @@ describe('SCE', function() { - // Work around an IE8 bug. Though window.inject === angular.mock.inject, if it's invoked the - // window scope, IE8 loses the exception object that bubbles up and replaces it with a TypeError. - // By using a local alias, it gets invoked on the global scope instead of window. - // Ref: https://github.com/angular/angular.js/pull/4221#/issuecomment-25515813 - var inject = angular.mock.inject; - describe('when disabled', function() { beforeEach(function() { module(function($sceProvider) { diff --git a/test/ngMock/angular-mocksSpec.js b/test/ngMock/angular-mocksSpec.js index f9c7587e86cc..711b3c09390f 100644 --- a/test/ngMock/angular-mocksSpec.js +++ b/test/ngMock/angular-mocksSpec.js @@ -719,8 +719,6 @@ describe('ngMock', function() { it('should serialize scope that has overridden "hasOwnProperty"', inject(function($rootScope, $sniffer) { /* jshint -W001 */ - // MS IE8 just doesn't work for this kind of thing, since "for ... in" doesn't return - // things like hasOwnProperty even if it is explicitly defined on the actual object! $rootScope.hasOwnProperty = 'X'; expect(d($rootScope)).toMatch(/Scope\(.*\): \{/); expect(d($rootScope)).toMatch(/hasOwnProperty: "X"/); @@ -906,10 +904,6 @@ describe('ngMock', function() { }); - // We don't run the following tests on IE8. - // IE8 throws "Object does not support this property or method." error, - // when thrown from a function defined on window (which `inject` is). - it('should not change thrown Errors', inject(function($sniffer) { expect(function() { inject(function() { diff --git a/test/ngRoute/directive/ngViewSpec.js b/test/ngRoute/directive/ngViewSpec.js index c428036aecc1..8e4b2a0a95dd 100644 --- a/test/ngRoute/directive/ngViewSpec.js +++ b/test/ngRoute/directive/ngViewSpec.js @@ -501,8 +501,7 @@ describe('ngView', function() { $location.url('/foo'); $rootScope.$digest(); - // using toMatch because in IE8+jquery the space doesn't get preserved. jquery bug? - expect(element.text()).toMatch(/\s*WORKS/); + expect(element.text()).toEqual(' \n WORKS'); var div = element.find('div'); expect(div.parent()[0].nodeName.toUpperCase()).toBeOneOf('NG:VIEW', 'VIEW');