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

Commit 4563b7a

Browse files
committed
chore(IE8) Remove more special code for IE8
1 parent 32d3cbb commit 4563b7a

File tree

6 files changed

+7
-34
lines changed

6 files changed

+7
-34
lines changed

src/Angular.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,7 @@ function forEach(obj, iterator, context) {
254254
if (obj) {
255255
if (isFunction(obj)) {
256256
for (key in obj) {
257-
// Need to check if hasOwnProperty exists,
258-
// as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
259-
if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
257+
if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) {
260258
iterator.call(context, obj[key], key, obj);
261259
}
262260
}

src/jqLite.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,9 @@ function jqLiteClone(element) {
274274
function jqLiteDealoc(element, onlyDescendants) {
275275
if (!onlyDescendants) jqLiteRemoveData(element);
276276

277-
if (element.querySelectorAll) {
278-
var descendants = element.querySelectorAll('*');
279-
for (var i = 0, l = descendants.length; i < l; i++) {
280-
jqLiteRemoveData(descendants[i]);
281-
}
277+
var descendants = element.querySelectorAll('*');
278+
for (var i = 0, l = descendants.length; i < l; i++) {
279+
jqLiteRemoveData(descendants[i]);
282280
}
283281
}
284282

src/ng/httpBackend.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
5858
xhr.onload = function requestLoaded() {
5959
var statusText = xhr.statusText || '';
6060

61-
// responseText is the old-school way of retrieving response (supported by IE8 & 9)
61+
// responseText is the old-school way of retrieving response (supported by IE9)
6262
// response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
6363
var response = ('response' in xhr) ? xhr.response : xhr.responseText;
6464

src/ng/location.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
316316
hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
317317

318318
this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
319-
// include hashPrefix in $$absUrl when $$url is empty so IE8 & 9 do not reload page because of removal of '#'
319+
// include hashPrefix in $$absUrl when $$url is empty so IE9 do not reload page because of removal of '#'
320320
this.$$absUrl = appBase + hashPrefix + this.$$url;
321321
};
322322

src/ng/urlUtils.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,13 @@ var originUrl = urlResolve(window.location.href);
2424
*
2525
* Implementation Notes for IE
2626
* ---------------------------
27-
* IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other
27+
* IE <= 11 normalizes the URL when assigned to the anchor node similar to the other
2828
* browsers. However, the parsed components will not be set if the URL assigned did not specify
2929
* them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We
3030
* work around that by performing the parsing in a 2nd step by taking a previously normalized
3131
* URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the
3232
* properties such as protocol, hostname, port, etc.
3333
*
34-
* IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one
35-
* uses the inner HTML approach to assign the URL as part of an HTML snippet -
36-
* http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.
37-
* Unfortunately, setting img[src] to something like "javascript:foo" on IE throws an exception.
38-
* Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that
39-
* method and IE < 8 is unsupported.
40-
*
4134
* References:
4235
* http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement
4336
* http://www.aptana.com/reference/html/api/HTMLAnchorElement.html

test/AngularSpec.js

-16
Original file line numberDiff line numberDiff line change
@@ -1072,22 +1072,6 @@ describe('angular', function() {
10721072
expect(log).toEqual(['0:a', '1:c']);
10731073
});
10741074

1075-
if (document.querySelectorAll) {
1076-
it('should handle the result of querySelectorAll in IE8 as it has no hasOwnProperty function', function() {
1077-
document.body.innerHTML = "<p>" +
1078-
"<a name='x'>a</a>" +
1079-
"<a name='y'>b</a>" +
1080-
"<a name='x'>c</a>" +
1081-
"</p>";
1082-
1083-
var htmlCollection = document.querySelectorAll('[name="x"]'),
1084-
log = [];
1085-
1086-
forEach(htmlCollection, function(value, key) { log.push(key + ':' + value.innerHTML); });
1087-
expect(log).toEqual(['0:a', '1:c']);
1088-
});
1089-
}
1090-
10911075
it('should handle arguments objects like arrays', function() {
10921076
var args,
10931077
log = [];

0 commit comments

Comments
 (0)