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

Commit ce05599

Browse files
committed
refactor(*): remove workarounds for IE <9, log all parameters in IE 9
1. Remove remanining workarounds for IE <9 2. Log all parameters in IE 9, not just the first two. 3. Update IE/Edge-related support comments. 4. ES6 classes now require Edge 14 or newer to work.
1 parent ad0bb83 commit ce05599

21 files changed

+91
-160
lines changed

.github/ISSUE_TEMPLATE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ https://plnkr.co or similar (you can use this template as a starting point: http
2929
**Angular version:** 1.x.y
3030
<!-- Check whether this is still an issue in the most recent stable or in the snapshot AngularJS version (https://code.angularjs.org/snapshot/) -->
3131

32-
**Browser:** [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
32+
**Browser:** [all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
3333
<!-- All browsers where this could be reproduced (and Operating System if relevant) -->
3434

3535
**Anything else:**
36-
<!-- e.g. stacktraces, related issues, suggestions how to fix -->
36+
<!-- e.g. stacktraces, related issues, suggestions how to fix -->

docs/config/templates/ngdoc/api/directive.template.html

-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ <h2 id="usage">Usage</h2>
1818
<ul>
1919
{% if doc.restrict.element %}
2020
<li>as element:
21-
{% if doc.name.indexOf('ng') == 0 -%}
22-
(This directive can be used as custom element, but be aware of <a href="guide/ie">IE restrictions</a>).
23-
{%- endif %}
2421
{% code %}
2522
<{$ doc.name | dashCase $}
2623
{%- for param in doc.params %}

docs/content/guide/bootstrap.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ initialization.
4040
<html ng-app>
4141

4242
3. If you choose to use the old style directive syntax `ng:` then include xml-namespace in `html`
43-
to make IE happy. (This is here for historical reasons, and we no longer recommend use of
44-
`ng:`.)
43+
when running the page in the XHTML mode. (This is here for historical reasons, and we no longer
44+
recommend use of `ng:`.)
4545

4646
<html xmlns:ng="http://angularjs.org">
4747

docs/content/guide/ie.ngdoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<div class="alert alert-warning">
99
**Note:** AngularJS 1.3 has dropped support for IE8. Read more about it on
10-
[our blog](http://blog.angularjs.org/2013/12/angularjs-13-new-release-approaches.html).
10+
[our blog](https://blog.angularjs.org/2013/12/angularjs-13-new-release-approaches.html).
1111
AngularJS 1.2 will continue to support IE8, but the core team does not plan to spend time
1212
addressing issues specific to IE8 or earlier.
1313
</div>
@@ -19,16 +19,16 @@ on IE.
1919
The project currently supports and will attempt to fix bugs for IE9 and above. The continuous
2020
integration server runs all the tests against IE9, IE10, and IE11. See
2121
[Travis CI](https://travis-ci.org/angular/angular.js) and
22-
[ci.angularjs.org](http://ci.angularjs.org).
22+
[ci.angularjs.org](https://ci.angularjs.org).
2323

2424
We do not run tests on IE8 and below. A subset of the AngularJS functionality may work on these
2525
browsers, but it is up to you to test and decide whether it works for your particular app.
2626

2727

2828
To ensure your AngularJS application works on IE please consider:
2929

30-
1. Use `ng-style` tags instead of `style="{{ someCss }}"`. The latter works in Chrome and Firefox
31-
but does not work in Internet Explorer <= 11 (the most recent version at time of writing).
30+
1. Use `ng-style` tags instead of `style="{{ someCss }}"`. The latter works in Chrome, Firefox,
31+
Safari and Edge but does not work in Internet Explorer (even 11).
3232
2. For the `type` attribute of buttons, use `ng-attr-type` tags instead of
3333
`type="{{ someExpression }}"`. If using the latter, Internet Explorer overwrites the expression
3434
with `type="submit"` before AngularJS has a chance to interpolate it.

docs/content/misc/faq.ngdoc

+2-4
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,8 @@ We run our extensive test suite against the following browsers: the latest versi
142142
Firefox, Safari, and Safari for iOS, as well as Internet Explorer versions 9-11. See
143143
{@link guide/ie Internet Explorer Compatibility} for more details on supporting legacy IE browsers.
144144

145-
If a browser is untested, it doesn't mean it won't work; for example, older Android (2.3.x)
146-
is supported in the sense that we avoid the dot notation for reserved words as property names,
147-
but we don't actively test changes against it. You can also expect browsers to work that share
148-
a large part of their codebase with a browser we test, such as Opera > version 12
145+
If a browser is untested, it doesn't mean it won't work. You can also expect browsers to work that
146+
share a large part of their codebase with a browser we test, such as Opera 15 or newer
149147
(uses the Blink engine), or the various Firefox derivatives.
150148

151149

src/Angular.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ function fromJson(json) {
13531353

13541354
var ALL_COLONS = /:/g;
13551355
function timezoneToOffset(timezone, fallback) {
1356-
// Support: IE 9-11 only, Edge 13-14+
1356+
// Support: IE 9-11 only, Edge 13-15+
13571357
// IE/Edge do not "understand" colon (`:`) in timezone
13581358
timezone = timezone.replace(ALL_COLONS, '');
13591359
var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
@@ -1380,12 +1380,7 @@ function convertTimezoneToLocal(date, timezone, reverse) {
13801380
* @returns {string} Returns the string representation of the element.
13811381
*/
13821382
function startingTag(element) {
1383-
element = jqLite(element).clone();
1384-
try {
1385-
// turns out IE does not let you set .html() on elements which
1386-
// are not allowed to have children. So we just ignore it.
1387-
element.empty();
1388-
} catch (e) { /* empty */ }
1383+
element = jqLite(element).clone().empty();
13891384
var elemHtml = jqLite('<div>').append(element).html();
13901385
try {
13911386
return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
@@ -1523,6 +1518,7 @@ function allowAutoBootstrap(document) {
15231518
var script = document.currentScript;
15241519

15251520
if (!script) {
1521+
// Support: IE 9-11 only
15261522
// IE does not have `document.currentScript`
15271523
return true;
15281524
}

src/auto/injector.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -876,9 +876,7 @@ function createInjector(modulesToLoad, strictDi) {
876876
}
877877
var result = func.$$ngIsClass;
878878
if (!isBoolean(result)) {
879-
// Support: Edge 12-13 only
880-
// See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/6156135/
881-
result = func.$$ngIsClass = /^(?:class\b|constructor\()/.test(stringifyFn(func));
879+
result = func.$$ngIsClass = /^class\b/.test(stringifyFn(func));
882880
}
883881
return result;
884882
}

src/ng/directive/ngOptions.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
407407
}
408408

409409

410-
// we can't just jqLite('<option>') since jqLite is not smart enough
410+
// Support: IE 9 only
411+
// We can't just jqLite('<option>') since jqLite is not smart enough
411412
// to create it in <select> and IE barfs otherwise.
412413
var optionTemplate = window.document.createElement('option'),
413414
optGroupTemplate = window.document.createElement('optgroup');
@@ -619,7 +620,8 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
619620
function updateOptionElement(option, element) {
620621
option.element = element;
621622
element.disabled = option.disabled;
622-
// NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive
623+
// Support: IE 11 only, Edge 12-13 only
624+
// NOTE: The label must be set before the value, otherwise IE 11 & Edge create unresponsive
623625
// selects in certain circumstances when multiple selects are next to each other and display
624626
// the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
625627
// See https://github.com/angular/angular.js/issues/11314 for more info.

src/ng/directive/select.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
var noopNgModelController = { $setViewValue: noop, $render: noop };
66

77
function setOptionSelectedStatus(optionEl, value) {
8-
optionEl.prop('selected', value); // needed for IE
8+
optionEl.prop('selected', value);
99
/**
1010
* When unselecting an option, setting the property to null / false should be enough
1111
* However, screenreaders might react to the selected attribute instead, see
@@ -40,6 +40,7 @@ var SelectController =
4040
// does not match any of the options. When it is rendered the value of the unknown
4141
// option is '? XXX ?' where XXX is the hashKey of the value that is not known.
4242
//
43+
// Support: IE 9 only
4344
// We can't just jqLite('<option>') since jqLite is not smart enough
4445
// to create it in <select> and IE barfs otherwise.
4546
self.unknownOption = jqLite(window.document.createElement('option'));
@@ -620,10 +621,11 @@ var selectDirective = function() {
620621
includes(value, selectCtrl.selectValueMap[option.value]));
621622
var currentlySelected = option.selected;
622623

623-
// IE and Edge, adding options to the selection via shift+click/UP/DOWN,
624+
// Support: IE 9-11 only, Edge 12-15+
625+
// In IE and Edge adding options to the selection via shift+click/UP/DOWN
624626
// will de-select already selected options if "selected" on those options was set
625627
// more than once (i.e. when the options were already selected)
626-
// So we only modify the selected property if neccessary.
628+
// So we only modify the selected property if necessary.
627629
// Note: this behavior cannot be replicated via unit tests because it only shows in the
628630
// actual user interface.
629631
if (shouldBeSelected !== currentlySelected) {

src/ng/log.js

+10-22
Original file line numberDiff line numberDiff line change
@@ -146,29 +146,17 @@ function $LogProvider() {
146146

147147
function consoleLog(type) {
148148
var console = $window.console || {},
149-
logFn = console[type] || console.log || noop,
150-
hasApply = false;
149+
logFn = console[type] || console.log || noop;
151150

152-
// Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
153-
// The reason behind this is that console.log has type "object" in IE8...
154-
try {
155-
hasApply = !!logFn.apply;
156-
} catch (e) { /* empty */ }
157-
158-
if (hasApply) {
159-
return function() {
160-
var args = [];
161-
forEach(arguments, function(arg) {
162-
args.push(formatError(arg));
163-
});
164-
return logFn.apply(console, args);
165-
};
166-
}
167-
168-
// we are IE which either doesn't have window.console => this is noop and we do nothing,
169-
// or we are IE where console.log doesn't have apply so we log at least first 2 args
170-
return function(arg1, arg2) {
171-
logFn(arg1, arg2 == null ? '' : arg2);
151+
return function() {
152+
var args = [];
153+
forEach(arguments, function(arg) {
154+
args.push(formatError(arg));
155+
});
156+
// Support: IE 9 only
157+
// console methods don't inherit from Function.prototype in IE 9 so we can't
158+
// call `logFn.apply(console, args)` directly.
159+
return Function.prototype.apply.call(logFn, console, args);
172160
};
173161
}
174162
}];

src/ngSanitize/sanitize.js

+3-13
Original file line numberDiff line numberDiff line change
@@ -313,26 +313,15 @@ function $SanitizeProvider() {
313313
return obj;
314314
}
315315

316-
var inertBodyElement;
317-
(function(window) {
316+
var inertBodyElement = (function(window) {
318317
var doc;
319318
if (window.document && window.document.implementation) {
320319
doc = window.document.implementation.createHTMLDocument('inert');
321320
} else {
322321
throw $sanitizeMinErr('noinert', 'Can\'t create an inert html document');
323322
}
324323
var docElement = doc.documentElement || doc.getDocumentElement();
325-
var bodyElements = docElement.getElementsByTagName('body');
326-
327-
// usually there should be only one body element in the document, but IE doesn't have any, so we need to create one
328-
if (bodyElements.length === 1) {
329-
inertBodyElement = bodyElements[0];
330-
} else {
331-
var html = doc.createElement('html');
332-
inertBodyElement = doc.createElement('body');
333-
html.appendChild(inertBodyElement);
334-
doc.appendChild(html);
335-
}
324+
return docElement.getElementsByTagName('body')[0];
336325
})(window);
337326

338327
/**
@@ -363,6 +352,7 @@ function $SanitizeProvider() {
363352
}
364353
mXSSAttempts--;
365354

355+
// Support: IE 9-11 only
366356
// strip custom-namespaced attributes on IE<=11
367357
if (window.document.documentMode) {
368358
stripCustomNsAttrs(inertBodyElement);

test/AngularSpec.js

+1
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,7 @@ describe('angular', function() {
17331733
dealoc(appElement);
17341734
});
17351735

1736+
// Support: IE 9-11 only
17361737
// IE does not support `document.currentScript` (nor extensions with protocol), so skip tests.
17371738
if (!msie) {
17381739
describe('auto bootstrap restrictions', function() {

test/helpers/privateMocks.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ function xthey(msg, vals, spec) {
3131
}
3232

3333
function browserSupportsCssAnimations() {
34-
// Support: IE < 10
35-
// Only IE10+ support keyframes / transitions
34+
// Support: IE 9 only
35+
// Only IE 10+ support keyframes / transitions
3636
return !(window.document.documentMode < 10);
3737
}
3838

test/helpers/testabilityPatch.js

+1-20
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ beforeEach(function() {
3030
if (window.publishExternalAPI) {
3131
publishExternalAPI(angular);
3232

33-
// workaround for IE bug https://plus.google.com/104744871076396904202/posts/Kqjuj6RSbbT
34-
// IE overwrite window.jQuery with undefined because of empty jQuery var statement, so we have to
35-
// correct this, but only if we are not running in jqLite mode
36-
if (!_jqLiteMode && _jQuery !== jQuery) {
37-
jQuery = _jQuery;
38-
}
39-
4033
// This resets global id counter;
4134
uid = 0;
4235

@@ -184,6 +177,7 @@ function sortedHtml(element, showNgClass) {
184177

185178
var attr = attributes[i];
186179
if (attr.name.match(/^ng[:-]/) ||
180+
!/^ng\d+/.test(attr.name) &&
187181
(attr.value || attr.value === '') &&
188182
attr.value !== 'null' &&
189183
attr.value !== 'auto' &&
@@ -199,19 +193,6 @@ function sortedHtml(element, showNgClass) {
199193
attr.name !== 'tabIndex' &&
200194
attr.name !== 'style' &&
201195
attr.name.substr(0, 6) !== 'jQuery') {
202-
// in IE we need to check for all of these.
203-
if (/ng\d+/.exec(attr.name) ||
204-
attr.name === 'getElementById' ||
205-
// IE7 has `selected` in attributes
206-
attr.name === 'selected' ||
207-
// IE7 adds `value` attribute to all LI tags
208-
(node.nodeName === 'LI' && attr.name === 'value') ||
209-
// IE8 adds bogus rowspan=1 and colspan=1 to TD elements
210-
(node.nodeName === 'TD' && attr.name === 'rowSpan' && attr.value === '1') ||
211-
(node.nodeName === 'TD' && attr.name === 'colSpan' && attr.value === '1')) {
212-
continue;
213-
}
214-
215196
attrs.push(' ' + attr.name + '="' + attr.value + '"');
216197
}
217198
}

test/jqLiteSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ describe('jqLite', function() {
13681368
expect(callback).toHaveBeenCalledTimes(1);
13691369
});
13701370

1371-
it('should set event.target on IE', function() {
1371+
it('should set event.target', function() {
13721372
var elm = jqLite(a);
13731373
elm.on('click', function(event) {
13741374
expect(event.target).toBe(a);

test/minErrSpec.js

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ describe('minErr', function() {
5353
arr, obj, anonFn, namedFn);
5454

5555
expect(myError.message).toContain('[test:26] arr: [1,2,3]; obj: {"a":123,"b":"baar"};');
56+
// Support: IE 9-11 only
5657
// IE does not add space after "function"
5758
expect(myError.message).toMatch(/anonFn: function\s?\(something\);/);
5859
expect(myError.message).toContain('namedFn: function foo(something)');

0 commit comments

Comments
 (0)