Skip to content

Commit e354c0f

Browse files
Merge pull request #18 from angular/master
Update upstream
2 parents 791ca42 + 8f563e2 commit e354c0f

32 files changed

+1181
-596
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
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/app/indexPage.template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
</head>
7171
<body class="homepage">
7272
<div id="wrapper">
73-
<header class="header" scroll-y-offset-element>
73+
<header class="header">
7474
<nav id="navbar-main" class="navbar navbar-fixed-top">
7575
<div class="navbar-inner" ng-controller="DocsSearchCtrl">
7676
<div class="container">
@@ -156,7 +156,7 @@ <h4 class="search-results-group-heading">{{ key }}</h4>
156156
</div>
157157
</div>
158158
</nav>
159-
<nav id="navbar-sub" class="sup-header navbar navbar-fixed-top">
159+
<nav id="navbar-sub" class="sup-header navbar navbar-fixed-top" scroll-y-offset-element>
160160
<div class="container main-grid main-header-grid">
161161
<div class="grid-left">
162162
<version-picker></version-picker>

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

Lines changed: 0 additions & 3 deletions
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/animations.ngdoc

Lines changed: 249 additions & 202 deletions
Large diffs are not rendered by default.

docs/content/guide/bootstrap.ngdoc

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 2 additions & 4 deletions
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

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -129,50 +129,6 @@ var VALIDITY_STATE_PROPERTY = 'validity';
129129

130130
var hasOwnProperty = Object.prototype.hasOwnProperty;
131131

132-
var minErrConfig = {
133-
objectMaxDepth: 5
134-
};
135-
136-
/**
137-
* @ngdoc function
138-
* @name angular.errorHandlingConfig
139-
* @module ng
140-
* @kind function
141-
*
142-
* @description
143-
* Configure several aspects of error handling in AngularJS if used as a setter or return the
144-
* current configuration if used as a getter. The following options are supported:
145-
*
146-
* - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages.
147-
*
148-
* Omitted or undefined options will leave the corresponding configuration values unchanged.
149-
*
150-
* @param {Object=} config - The configuration object. May only contain the options that need to be
151-
* updated. Supported keys:
152-
*
153-
* * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a
154-
* non-positive or non-numeric value, removes the max depth limit.
155-
* Default: 5
156-
*/
157-
function errorHandlingConfig(config) {
158-
if (isObject(config)) {
159-
if (isDefined(config.objectMaxDepth)) {
160-
minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN;
161-
}
162-
} else {
163-
return minErrConfig;
164-
}
165-
}
166-
167-
/**
168-
* @private
169-
* @param {Number} maxDepth
170-
* @return {boolean}
171-
*/
172-
function isValidObjectMaxDepth(maxDepth) {
173-
return isNumber(maxDepth) && maxDepth > 0;
174-
}
175-
176132
/**
177133
* @private
178134
*
@@ -1353,7 +1309,7 @@ function fromJson(json) {
13531309

13541310
var ALL_COLONS = /:/g;
13551311
function timezoneToOffset(timezone, fallback) {
1356-
// Support: IE 9-11 only, Edge 13-14+
1312+
// Support: IE 9-11 only, Edge 13-15+
13571313
// IE/Edge do not "understand" colon (`:`) in timezone
13581314
timezone = timezone.replace(ALL_COLONS, '');
13591315
var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
@@ -1380,12 +1336,7 @@ function convertTimezoneToLocal(date, timezone, reverse) {
13801336
* @returns {string} Returns the string representation of the element.
13811337
*/
13821338
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 */ }
1339+
element = jqLite(element).clone().empty();
13891340
var elemHtml = jqLite('<div>').append(element).html();
13901341
try {
13911342
return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
@@ -1523,6 +1474,7 @@ function allowAutoBootstrap(document) {
15231474
var script = document.currentScript;
15241475

15251476
if (!script) {
1477+
// Support: IE 9-11 only
15261478
// IE does not have `document.currentScript`
15271479
return true;
15281480
}

src/auto/injector.js

Lines changed: 1 addition & 3 deletions
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/loader.prefix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,31 @@
55
*/
66
'use strict';
77
(function() {
8+
// NOTE:
9+
// These functions are copied here from `src/Angular.js`, because they are needed inside the
10+
// `angular-loader.js` closure and need to be available before the main `angular.js` script has
11+
// been loaded.
812
function isFunction(value) {return typeof value === 'function';}
913
function isDefined(value) {return typeof value !== 'undefined';}
14+
function isNumber(value) {return typeof value === 'number';}
1015
function isObject(value) {return value !== null && typeof value === 'object';}
16+
function isScope(obj) {return obj && obj.$evalAsync && obj.$watch;}
17+
function isUndefined(value) {return typeof value === 'undefined';}
18+
function isWindow(obj) {return obj && obj.window === obj;}
19+
function sliceArgs(args, startIndex) {return Array.prototype.slice.call(args, startIndex || 0);}
20+
function toJsonReplacer(key, value) {
21+
var val = value;
22+
23+
if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
24+
val = undefined;
25+
} else if (isWindow(value)) {
26+
val = '$WINDOW';
27+
} else if (value && window.document === value) {
28+
val = '$DOCUMENT';
29+
} else if (isScope(value)) {
30+
val = '$SCOPE';
31+
}
32+
33+
return val;
34+
}
1135

src/minErr.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,55 @@
11
'use strict';
22

3+
/* exported
4+
minErrConfig,
5+
errorHandlingConfig,
6+
isValidObjectMaxDepth
7+
*/
8+
9+
var minErrConfig = {
10+
objectMaxDepth: 5
11+
};
12+
13+
/**
14+
* @ngdoc function
15+
* @name angular.errorHandlingConfig
16+
* @module ng
17+
* @kind function
18+
*
19+
* @description
20+
* Configure several aspects of error handling in AngularJS if used as a setter or return the
21+
* current configuration if used as a getter. The following options are supported:
22+
*
23+
* - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages.
24+
*
25+
* Omitted or undefined options will leave the corresponding configuration values unchanged.
26+
*
27+
* @param {Object=} config - The configuration object. May only contain the options that need to be
28+
* updated. Supported keys:
29+
*
30+
* * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a
31+
* non-positive or non-numeric value, removes the max depth limit.
32+
* Default: 5
33+
*/
34+
function errorHandlingConfig(config) {
35+
if (isObject(config)) {
36+
if (isDefined(config.objectMaxDepth)) {
37+
minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN;
38+
}
39+
} else {
40+
return minErrConfig;
41+
}
42+
}
43+
44+
/**
45+
* @private
46+
* @param {Number} maxDepth
47+
* @return {boolean}
48+
*/
49+
function isValidObjectMaxDepth(maxDepth) {
50+
return isNumber(maxDepth) && maxDepth > 0;
51+
}
52+
353
/**
454
* @description
555
*

src/ng/animate.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ var $$CoreAnimateQueueProvider = /** @this */ function() {
180180
var $AnimateProvider = ['$provide', /** @this */ function($provide) {
181181
var provider = this;
182182
var classNameFilter = null;
183+
var customFilter = null;
183184

184185
this.$$registeredAnimations = Object.create(null);
185186

@@ -232,6 +233,51 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
232233
$provide.factory(key, factory);
233234
};
234235

236+
/**
237+
* @ngdoc method
238+
* @name $animateProvider#customFilter
239+
*
240+
* @description
241+
* Sets and/or returns the custom filter function that is used to "filter" animations, i.e.
242+
* determine if an animation is allowed or not. When no filter is specified (the default), no
243+
* animation will be blocked. Setting the `customFilter` value will only allow animations for
244+
* which the filter function's return value is truthy.
245+
*
246+
* This allows to easily create arbitrarily complex rules for filtering animations, such as
247+
* allowing specific events only, or enabling animations on specific subtrees of the DOM, etc.
248+
* Filtering animations can also boost performance for low-powered devices, as well as
249+
* applications containing a lot of structural operations.
250+
*
251+
* <div class="alert alert-success">
252+
* **Best Practice:**
253+
* Keep the filtering function as lean as possible, because it will be called for each DOM
254+
* action (e.g. insertion, removal, class change) performed by "animation-aware" directives.
255+
* See {@link guide/animations#which-directives-support-animations- here} for a list of built-in
256+
* directives that support animations.
257+
* Performing computationally expensive or time-consuming operations on each call of the
258+
* filtering function can make your animations sluggish.
259+
* </div>
260+
*
261+
* **Note:** If present, `customFilter` will be checked before
262+
* {@link $animateProvider#classNameFilter classNameFilter}.
263+
*
264+
* @param {Function=} filterFn - The filter function which will be used to filter all animations.
265+
* If a falsy value is returned, no animation will be performed. The function will be called
266+
* with the following arguments:
267+
* - **node** `{DOMElement}` - The DOM element to be animated.
268+
* - **event** `{String}` - The name of the animation event (e.g. `enter`, `leave`, `addClass`
269+
* etc).
270+
* - **options** `{Object}` - A collection of options/styles used for the animation.
271+
* @return {Function} The current filter function or `null` if there is none set.
272+
*/
273+
this.customFilter = function(filterFn) {
274+
if (arguments.length === 1) {
275+
customFilter = isFunction(filterFn) ? filterFn : null;
276+
}
277+
278+
return customFilter;
279+
};
280+
235281
/**
236282
* @ngdoc method
237283
* @name $animateProvider#classNameFilter
@@ -243,6 +289,11 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
243289
* When setting the `classNameFilter` value, animations will only be performed on elements
244290
* that successfully match the filter expression. This in turn can boost performance
245291
* for low-powered devices as well as applications containing a lot of structural operations.
292+
*
293+
* **Note:** If present, `classNameFilter` will be checked after
294+
* {@link $animateProvider#customFilter customFilter}. If `customFilter` is present and returns
295+
* false, `classNameFilter` will not be checked.
296+
*
246297
* @param {RegExp=} expression The className expression which will be checked against all animations
247298
* @return {RegExp} The current CSS className expression value. If null then there is no expression value
248299
*/

0 commit comments

Comments
 (0)