Skip to content

Commit 1644fae

Browse files
committed
refactor: remove the remaining IE8 code bits from the codebase
Closes angular#9356
1 parent 6593c23 commit 1644fae

File tree

7 files changed

+34
-98
lines changed

7 files changed

+34
-98
lines changed

docs/content/error/$httpBackend/noxhr.ngdoc

-10
This file was deleted.

docs/content/error/$sce/iequirks.ngdoc

-17
This file was deleted.

src/ng/compile.js

+25-27
Original file line numberDiff line numberDiff line change
@@ -1218,37 +1218,35 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
12181218
var attrEndName = false;
12191219

12201220
attr = nAttrs[j];
1221-
if (!msie || msie >= 8 || attr.specified) {
1222-
name = attr.name;
1223-
value = trim(attr.value);
1224-
1225-
// support ngAttr attribute binding
1226-
ngAttrName = directiveNormalize(name);
1227-
if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {
1228-
name = snake_case(ngAttrName.substr(6), '-');
1229-
}
1221+
name = attr.name;
1222+
value = trim(attr.value);
12301223

1231-
var directiveNName = ngAttrName.replace(/(Start|End)$/, '');
1232-
if (directiveIsMultiElement(directiveNName)) {
1233-
if (ngAttrName === directiveNName + 'Start') {
1234-
attrStartName = name;
1235-
attrEndName = name.substr(0, name.length - 5) + 'end';
1236-
name = name.substr(0, name.length - 6);
1237-
}
1238-
}
1224+
// support ngAttr attribute binding
1225+
ngAttrName = directiveNormalize(name);
1226+
if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {
1227+
name = snake_case(ngAttrName.substr(6), '-');
1228+
}
12391229

1240-
nName = directiveNormalize(name.toLowerCase());
1241-
attrsMap[nName] = name;
1242-
if (isNgAttr || !attrs.hasOwnProperty(nName)) {
1243-
attrs[nName] = value;
1244-
if (getBooleanAttrName(node, nName)) {
1245-
attrs[nName] = true; // presence means true
1246-
}
1230+
var directiveNName = ngAttrName.replace(/(Start|End)$/, '');
1231+
if (directiveIsMultiElement(directiveNName)) {
1232+
if (ngAttrName === directiveNName + 'Start') {
1233+
attrStartName = name;
1234+
attrEndName = name.substr(0, name.length - 5) + 'end';
1235+
name = name.substr(0, name.length - 6);
12471236
}
1248-
addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);
1249-
addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,
1250-
attrEndName);
12511237
}
1238+
1239+
nName = directiveNormalize(name.toLowerCase());
1240+
attrsMap[nName] = name;
1241+
if (isNgAttr || !attrs.hasOwnProperty(nName)) {
1242+
attrs[nName] = value;
1243+
if (getBooleanAttrName(node, nName)) {
1244+
attrs[nName] = true; // presence means true
1245+
}
1246+
}
1247+
addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);
1248+
addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,
1249+
attrEndName);
12521250
}
12531251

12541252
// use class as directive

src/ng/directive/a.js

-16
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,6 @@
1616
var htmlAnchorDirective = valueFn({
1717
restrict: 'E',
1818
compile: function(element, attr) {
19-
20-
if (msie <= 8) {
21-
22-
// turn <a href ng-click="..">link</a> into a stylable link in IE
23-
// but only if it doesn't have name attribute, in which case it's an anchor
24-
if (!attr.href && !attr.name) {
25-
attr.$set('href', '');
26-
}
27-
28-
// add a comment node to anchors to workaround IE bug that causes element content to be reset
29-
// to new attribute content if attribute is updated with value containing @ and element also
30-
// contains value with @
31-
// see issue #1949
32-
element.append(document.createComment('IE fix'));
33-
}
34-
3519
if (!attr.href && !attr.xlinkHref && !attr.name) {
3620
return function(scope, element) {
3721
// SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.

src/ng/httpBackend.js

+4-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
'use strict';
22

3-
function createXhr(method) {
4-
//if IE and the method is not RFC2616 compliant, or if XMLHttpRequest
5-
//is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest
6-
//if it is available
7-
if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||
8-
!window.XMLHttpRequest)) {
9-
return new window.ActiveXObject("Microsoft.XMLHTTP");
10-
} else if (window.XMLHttpRequest) {
11-
return new window.XMLHttpRequest();
12-
}
13-
14-
throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest.");
3+
// TODO: inline the constructor call and remove this helper method
4+
function createXhr() {
5+
return new window.XMLHttpRequest();
156
}
167

178
/**
@@ -59,7 +50,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
5950
});
6051
} else {
6152

62-
var xhr = createXhr(method);
53+
var xhr = createXhr();
6354

6455
xhr.open(method, url, true);
6556
forEach(headers, function(value, key) {

src/ng/sanitizeUri.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,12 @@ function $$SanitizeUriProvider() {
6060
this.$get = function() {
6161
return function sanitizeUri(uri, isImage) {
6262
var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;
63-
var normalizedVal;
64-
// NOTE: urlResolve() doesn't support IE < 8 so we don't sanitize for that case.
65-
if (!msie || msie >= 8 ) {
66-
normalizedVal = urlResolve(uri).href;
67-
if (normalizedVal !== '' && !normalizedVal.match(regex)) {
68-
return 'unsafe:'+normalizedVal;
69-
}
63+
var normalizedVal = urlResolve(uri).href;
64+
65+
if (normalizedVal !== '' && !normalizedVal.match(regex)) {
66+
return 'unsafe:'+normalizedVal;
7067
}
68+
7169
return uri;
7270
};
7371
};

src/ng/sce.js

-8
Original file line numberDiff line numberDiff line change
@@ -729,14 +729,6 @@ function $SceProvider() {
729729

730730
this.$get = ['$parse', '$sniffer', '$sceDelegate', function(
731731
$parse, $sniffer, $sceDelegate) {
732-
// Prereq: Ensure that we're not running in IE8 quirks mode. In that mode, IE allows
733-
// the "expression(javascript expression)" syntax which is insecure.
734-
if (enabled && $sniffer.msie && $sniffer.msieDocumentMode < 8) {
735-
throw $sceMinErr('iequirks',
736-
'Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks ' +
737-
'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' +
738-
'document. See http://docs.angularjs.org/api/ng.$sce for more information.');
739-
}
740732

741733
var sce = shallowCopy(SCE_CONTEXTS);
742734

0 commit comments

Comments
 (0)