1
1
/**
2
- * @license AngularJS v1.7.9
3
- * (c) 2010-2018 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.8.0
3
+ * (c) 2010-2020 Google, Inc. http://angularjs.org
4
4
* License: MIT
5
5
*/
6
6
(function(window) {'use strict';
@@ -37,7 +37,7 @@ var minErrConfig = {
37
37
* non-positive or non-numeric value, removes the max depth limit.
38
38
* Default: 5
39
39
*
40
- * * `urlErrorParamsEnabled` **{Boolean}** - Specifies wether the generated error url will
40
+ * * `urlErrorParamsEnabled` **{Boolean}** - Specifies whether the generated error url will
41
41
* contain the parameters of the thrown error. Disabling the parameters can be useful if the
42
42
* generated error url is very long.
43
43
*
@@ -87,7 +87,7 @@ function isValidObjectMaxDepth(maxDepth) {
87
87
* Since data will be parsed statically during a build step, some restrictions
88
88
* are applied with respect to how minErr instances are created and called.
89
89
* Instances should have names of the form namespaceMinErr for a minErr created
90
- * using minErr('namespace') . Error codes, namespaces and template strings
90
+ * using minErr('namespace'). Error codes, namespaces and template strings
91
91
* should all be static strings, not variables or general expressions.
92
92
*
93
93
* @param {string} module The namespace to use for the new minErr instance.
@@ -99,7 +99,7 @@ function isValidObjectMaxDepth(maxDepth) {
99
99
function minErr(module, ErrorConstructor) {
100
100
ErrorConstructor = ErrorConstructor || Error;
101
101
102
- var url = 'https://errors.angularjs.org/1.7.9 /';
102
+ var url = 'https://errors.angularjs.org/1.8.0 /';
103
103
var regex = url.replace('.', '\\.') + '[\\s\\S]*';
104
104
var errRegExp = new RegExp(regex, 'g');
105
105
@@ -232,6 +232,7 @@ function minErr(module, ErrorConstructor) {
232
232
hasOwnProperty,
233
233
createMap,
234
234
stringify,
235
+ UNSAFE_restoreLegacyJqLiteXHTMLReplacement,
235
236
236
237
NODE_TYPE_ELEMENT,
237
238
NODE_TYPE_ATTRIBUTE,
@@ -959,8 +960,8 @@ function arrayRemove(array, value) {
959
960
* - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream)
960
961
* - [`Set`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)
961
962
* - [`WeakMap`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)
962
- * - [' getter' ](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/
963
- * [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)`
963
+ * - [` getter` ](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/
964
+ * [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)
964
965
*
965
966
* @param {*} source The source that will be used to make a copy. Can be any type, including
966
967
* primitives, `null`, and `undefined`.
@@ -2088,6 +2089,26 @@ function bindJQuery() {
2088
2089
bindJQueryFired = true;
2089
2090
}
2090
2091
2092
+ /**
2093
+ * @ngdoc function
2094
+ * @name angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement
2095
+ * @module ng
2096
+ * @kind function
2097
+ *
2098
+ * @description
2099
+ * Restores the pre-1.8 behavior of jqLite that turns XHTML-like strings like
2100
+ * `<div /><span />` to `<div></div><span></span>` instead of `<div><span></span></div>`.
2101
+ * The new behavior is a security fix. Thus, if you need to call this function, please try to adjust
2102
+ * your code for this change and remove your use of this function as soon as possible.
2103
+
2104
+ * Note that this only patches jqLite. If you use jQuery 3.5.0 or newer, please read the
2105
+ * [jQuery 3.5 upgrade guide](https://jquery.com/upgrade-guide/3.5/) for more details
2106
+ * about the workarounds.
2107
+ */
2108
+ function UNSAFE_restoreLegacyJqLiteXHTMLReplacement() {
2109
+ JQLite.legacyXHTMLReplacement = true;
2110
+ }
2111
+
2091
2112
/**
2092
2113
* throw error if the argument is falsy.
2093
2114
*/
@@ -2807,11 +2828,11 @@ function toDebugString(obj, maxDepth) {
2807
2828
var version = {
2808
2829
// These placeholder strings will be replaced by grunt's `build` task.
2809
2830
// They need to be double- or single-quoted.
2810
- full: '1.7.9 ',
2831
+ full: '1.8.0 ',
2811
2832
major: 1,
2812
- minor: 7 ,
2813
- dot: 9 ,
2814
- codeName: 'pollution-eradication '
2833
+ minor: 8 ,
2834
+ dot: 0 ,
2835
+ codeName: 'nested-vaccination '
2815
2836
};
2816
2837
2817
2838
@@ -2844,6 +2865,7 @@ function publishExternalAPI(angular) {
2844
2865
'callbacks': {$$counter: 0},
2845
2866
'getTestability': getTestability,
2846
2867
'reloadWithDebugInfo': reloadWithDebugInfo,
2868
+ 'UNSAFE_restoreLegacyJqLiteXHTMLReplacement': UNSAFE_restoreLegacyJqLiteXHTMLReplacement,
2847
2869
'$$minErr': minErr,
2848
2870
'$$csp': csp,
2849
2871
'$$encodeUriSegment': encodeUriSegment,
@@ -2961,7 +2983,7 @@ function publishExternalAPI(angular) {
2961
2983
});
2962
2984
}
2963
2985
])
2964
- .info({ angularVersion: '1.7.9 ' });
2986
+ .info({ angularVersion: '1.8.0 ' });
2965
2987
}
2966
2988
2967
2989
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -3054,6 +3076,16 @@ function publishExternalAPI(angular) {
3054
3076
* - [`val()`](http://api.jquery.com/val/)
3055
3077
* - [`wrap()`](http://api.jquery.com/wrap/)
3056
3078
*
3079
+ * jqLite also provides a method restoring pre-1.8 insecure treatment of XHTML-like tags.
3080
+ * This legacy behavior turns input like `<div /><span />` to `<div></div><span></span>`
3081
+ * instead of `<div><span></span></div>` like version 1.8 & newer do. To restore it, invoke:
3082
+ * ```js
3083
+ * angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement();
3084
+ * ```
3085
+ * Note that this only patches jqLite. If you use jQuery 3.5.0 or newer, please read the
3086
+ * [jQuery 3.5 upgrade guide](https://jquery.com/upgrade-guide/3.5/) for more details
3087
+ * about the workarounds.
3088
+ *
3057
3089
* ## jQuery/jqLite Extras
3058
3090
* AngularJS also provides the following additional methods and events to both jQuery and jqLite:
3059
3091
*
@@ -3133,20 +3165,36 @@ var HTML_REGEXP = /<|&#?\w+;/;
3133
3165
var TAG_NAME_REGEXP = /<([\w:-]+)/;
3134
3166
var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi;
3135
3167
3168
+ // Table parts need to be wrapped with `<table>` or they're
3169
+ // stripped to their contents when put in a div.
3170
+ // XHTML parsers do not magically insert elements in the
3171
+ // same way that tag soup parsers do, so we cannot shorten
3172
+ // this by omitting <tbody> or other required elements.
3136
3173
var wrapMap = {
3137
- 'option': [1, '<select multiple="multiple">', '</select>'],
3138
-
3139
- 'thead': [1, '<table>', '</table>'],
3140
- 'col': [2, '<table><colgroup>', '</colgroup></table>'],
3141
- 'tr': [2, '<table><tbody>', '</tbody></table>'],
3142
- 'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
3143
- '_default': [0, '', '']
3174
+ thead: ['table'],
3175
+ col: ['colgroup', 'table'],
3176
+ tr: ['tbody', 'table'],
3177
+ td: ['tr', 'tbody', 'table']
3144
3178
};
3145
3179
3146
- wrapMap.optgroup = wrapMap.option;
3147
3180
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
3148
3181
wrapMap.th = wrapMap.td;
3149
3182
3183
+ // Support: IE <10 only
3184
+ // IE 9 requires an option wrapper & it needs to have the whole table structure
3185
+ // set up in advance; assigning `"<td></td>"` to `tr.innerHTML` doesn't work, etc.
3186
+ var wrapMapIE9 = {
3187
+ option: [1, '<select multiple="multiple">', '</select>'],
3188
+ _default: [0, '', '']
3189
+ };
3190
+
3191
+ for (var key in wrapMap) {
3192
+ var wrapMapValueClosing = wrapMap[key];
3193
+ var wrapMapValue = wrapMapValueClosing.slice().reverse();
3194
+ wrapMapIE9[key] = [wrapMapValue.length, '<' + wrapMapValue.join('><') + '>', '</' + wrapMapValueClosing.join('></') + '>'];
3195
+ }
3196
+
3197
+ wrapMapIE9.optgroup = wrapMapIE9.option;
3150
3198
3151
3199
function jqLiteIsTextNode(html) {
3152
3200
return !HTML_REGEXP.test(html);
@@ -3167,7 +3215,7 @@ function jqLiteHasData(node) {
3167
3215
}
3168
3216
3169
3217
function jqLiteBuildFragment(html, context) {
3170
- var tmp, tag, wrap,
3218
+ var tmp, tag, wrap, finalHtml,
3171
3219
fragment = context.createDocumentFragment(),
3172
3220
nodes = [], i;
3173
3221
@@ -3178,13 +3226,30 @@ function jqLiteBuildFragment(html, context) {
3178
3226
// Convert html into DOM nodes
3179
3227
tmp = fragment.appendChild(context.createElement('div'));
3180
3228
tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase();
3181
- wrap = wrapMap[tag] || wrapMap._default;
3182
- tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1></$2>') + wrap[2];
3229
+ finalHtml = JQLite.legacyXHTMLReplacement ?
3230
+ html.replace(XHTML_TAG_REGEXP, '<$1></$2>') :
3231
+ html;
3183
3232
3184
- // Descend through wrappers to the right content
3185
- i = wrap[0];
3186
- while (i--) {
3187
- tmp = tmp.lastChild;
3233
+ if (msie < 10) {
3234
+ wrap = wrapMapIE9[tag] || wrapMapIE9._default;
3235
+ tmp.innerHTML = wrap[1] + finalHtml + wrap[2];
3236
+
3237
+ // Descend through wrappers to the right content
3238
+ i = wrap[0];
3239
+ while (i--) {
3240
+ tmp = tmp.firstChild;
3241
+ }
3242
+ } else {
3243
+ wrap = wrapMap[tag] || [];
3244
+
3245
+ // Create wrappers & descend into them
3246
+ i = wrap.length;
3247
+ while (--i > -1) {
3248
+ tmp.appendChild(window.document.createElement(wrap[i]));
3249
+ tmp = tmp.firstChild;
3250
+ }
3251
+
3252
+ tmp.innerHTML = finalHtml;
3188
3253
}
3189
3254
3190
3255
nodes = concat(nodes, tmp.childNodes);
@@ -8283,7 +8348,7 @@ function $TemplateCacheProvider() {
8283
8348
*
8284
8349
* When the original node and the replace template declare the same directive(s), they will be
8285
8350
* {@link guide/compiler#double-compilation-and-how-to-avoid-it compiled twice} because the compiler
8286
- * does not deduplicate them. In many cases, this is not noticable , but e.g. {@link ngModel} will
8351
+ * does not deduplicate them. In many cases, this is not noticeable , but e.g. {@link ngModel} will
8287
8352
* attach `$formatters` and `$parsers` twice.
8288
8353
*
8289
8354
* See issue [#2573](https://github.com/angular/angular.js/issues/2573).
@@ -33606,7 +33671,7 @@ var ngRefDirective = ['$parse', function($parse) {
33606
33671
* For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after
33607
33672
* the items have been processed through the filter.
33608
33673
*
33609
- * Please note that `as [variable name] is not an operator but rather a part of ngRepeat
33674
+ * Please note that `as [variable name]` is not an operator but rather a part of ngRepeat
33610
33675
* micro-syntax so it can be used only after all filters (and not as operator, inside an expression).
33611
33676
*
33612
33677
* For example: `item in items | filter : x | orderBy : order | limitTo : limit as results track by item.id` .
@@ -34415,11 +34480,11 @@ var ngHideDirective = ['$animate', function($animate) {
34415
34480
var colorSpan = element(by.css('span'));
34416
34481
34417
34482
it('should check ng-style', function() {
34418
- expect(colorSpan.getCssValue('color')).toBe(' rgba(0, 0, 0, 1)' );
34483
+ expect(colorSpan.getCssValue('color')).toMatch(/ rgba\ (0, 0, 0, 1\)|rgb\(0, 0, 0\)/ );
34419
34484
element(by.css('input[value=\'set color\']')).click();
34420
- expect(colorSpan.getCssValue('color')).toBe(' rgba(255, 0, 0, 1)' );
34485
+ expect(colorSpan.getCssValue('color')).toMatch(/ rgba\ (255, 0, 0, 1\)|rgb\(255, 0, 0\)/ );
34421
34486
element(by.css('input[value=clear]')).click();
34422
- expect(colorSpan.getCssValue('color')).toBe(' rgba(0, 0, 0, 1)' );
34487
+ expect(colorSpan.getCssValue('color')).toMatch(/ rgba\ (0, 0, 0, 1\)|rgb\(0, 0, 0\)/ );
34423
34488
});
34424
34489
</file>
34425
34490
</example>
@@ -36428,4 +36493,4 @@ $provide.value("$locale", {
36428
36493
36429
36494
})(window);
36430
36495
36431
- !window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type="text/css"> @charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>' );
36496
+ !window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend(window.angular.element( '<style>').text(' @charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}') );
0 commit comments