Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Remove more bits and pieces of Internet Explorer 8 support #9478

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,7 @@ function forEach(obj, iterator, context) {
if (obj) {
if (isFunction(obj)) {
for (key in obj) {
// Need to check if hasOwnProperty exists,
// as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) {
iterator.call(context, obj[key], key, obj);
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,9 @@ function jqLiteClone(element) {
function jqLiteDealoc(element, onlyDescendants) {
if (!onlyDescendants) jqLiteRemoveData(element);

if (element.querySelectorAll) {
var descendants = element.querySelectorAll('*');
for (var i = 0, l = descendants.length; i < l; i++) {
jqLiteRemoveData(descendants[i]);
}
var descendants = element.querySelectorAll('*');
for (var i = 0, l = descendants.length; i < l; i++) {
jqLiteRemoveData(descendants[i]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/ng/httpBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/ng/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 do not reload page because of removal of '#'
this.$$absUrl = appBase + hashPrefix + this.$$url;
};

Expand Down
9 changes: 1 addition & 8 deletions src/ng/urlUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <= 11 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
Expand Down
16 changes: 0 additions & 16 deletions test/AngularSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1072,22 +1072,6 @@ describe('angular', function() {
expect(log).toEqual(['0:a', '1:c']);
});

if (document.querySelectorAll) {
it('should handle the result of querySelectorAll in IE8 as it has no hasOwnProperty function', function() {
document.body.innerHTML = "<p>" +
"<a name='x'>a</a>" +
"<a name='y'>b</a>" +
"<a name='x'>c</a>" +
"</p>";

var htmlCollection = document.querySelectorAll('[name="x"]'),
log = [];

forEach(htmlCollection, function(value, key) { log.push(key + ':' + value.innerHTML); });
expect(log).toEqual(['0:a', '1:c']);
});
}

it('should handle arguments objects like arrays', function() {
var args,
log = [];
Expand Down
2 changes: 1 addition & 1 deletion test/ng/httpBackendSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it's only IE9 here, so we should call that out specifically. Unless we're trying to support Android < 4.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a workaround for Android < 4 in ngSniffer so it seems so.


$backend('GET', '/whatever', null, callback, {}, null, null, 'blob');

Expand Down
6 changes: 0 additions & 6 deletions test/ng/sceSpecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 0 additions & 7 deletions test/ngMock/angular-mocksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"/);
Expand Down Expand Up @@ -905,11 +903,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() {
Expand Down