@angular/core 11.0.4 → 11.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/core-testing.umd.js +1 -1
- package/bundles/core-testing.umd.min.js +1 -1
- package/bundles/core-testing.umd.min.js.map +1 -1
- package/bundles/core.umd.js +94 -35
- package/bundles/core.umd.js.map +1 -1
- package/bundles/core.umd.min.js +112 -105
- package/bundles/core.umd.min.js.map +1 -1
- package/core.d.ts +4 -4
- package/core.metadata.json +1 -1
- package/esm2015/src/application_ref.js +2 -2
- package/esm2015/src/di/injector_compatibility.js +5 -2
- package/esm2015/src/linker/view_container_ref.js +2 -2
- package/esm2015/src/render3/hooks.js +4 -4
- package/esm2015/src/render3/instructions/listener.js +4 -4
- package/esm2015/src/render3/instructions/shared.js +8 -7
- package/esm2015/src/render3/node_manipulation.js +9 -8
- package/esm2015/src/render3/view_ref.js +23 -12
- package/esm2015/src/sanitization/inert_body.js +12 -2
- package/esm2015/src/util/dom.js +36 -0
- package/esm2015/src/util/global.js +1 -1
- package/esm2015/src/util/is_dev_mode.js +7 -1
- package/esm2015/src/version.js +1 -1
- package/esm2015/src/view/services.js +4 -3
- package/fesm2015/core.js +95 -34
- package/fesm2015/core.js.map +1 -1
- package/fesm2015/testing.js +1 -1
- package/package.json +1 -1
- package/src/r3_symbols.d.ts +1 -1
- package/testing/testing.d.ts +1 -1
- package/testing.d.ts +1 -1
package/bundles/core.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v11.0.
|
|
2
|
+
* @license Angular v11.0.8
|
|
3
3
|
* (c) 2010-2020 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2713,8 +2713,9 @@
|
|
|
2713
2713
|
(currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */) :
|
|
2714
2714
|
0;
|
|
2715
2715
|
var nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;
|
|
2716
|
+
var max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1
|
|
2716
2717
|
var lastNodeIndexFound = 0;
|
|
2717
|
-
for (var i = startIndex; i <
|
|
2718
|
+
for (var i = startIndex; i < max; i++) {
|
|
2718
2719
|
var hook = arr[i + 1];
|
|
2719
2720
|
if (typeof hook === 'number') {
|
|
2720
2721
|
lastNodeIndexFound = arr[i];
|
|
@@ -2751,8 +2752,7 @@
|
|
|
2751
2752
|
var directive = currentView[directiveIndex];
|
|
2752
2753
|
if (isInitHook) {
|
|
2753
2754
|
var indexWithintInitPhase = currentView[FLAGS] >> 11 /* IndexWithinInitPhaseShift */;
|
|
2754
|
-
// The init phase state must be always checked here as it may have been recursively
|
|
2755
|
-
// updated
|
|
2755
|
+
// The init phase state must be always checked here as it may have been recursively updated.
|
|
2756
2756
|
if (indexWithintInitPhase <
|
|
2757
2757
|
(currentView[PREORDER_HOOK_FLAGS] >> 16 /* NumberOfInitHooksCalledShift */) &&
|
|
2758
2758
|
(currentView[FLAGS] & 3 /* InitPhaseStateMask */) === initPhase) {
|
|
@@ -5274,6 +5274,9 @@
|
|
|
5274
5274
|
else if (meta instanceof Self || meta.ngMetadataName === 'Self' || meta === Self) {
|
|
5275
5275
|
flags |= exports.InjectFlags.Self;
|
|
5276
5276
|
}
|
|
5277
|
+
else if (meta instanceof Host || meta.ngMetadataName === 'Host' || meta === Host) {
|
|
5278
|
+
flags |= exports.InjectFlags.Host;
|
|
5279
|
+
}
|
|
5277
5280
|
else if (meta instanceof Inject || meta === Inject) {
|
|
5278
5281
|
type = meta.token;
|
|
5279
5282
|
}
|
|
@@ -5590,14 +5593,16 @@
|
|
|
5590
5593
|
* Fallback: InertDocument strategy
|
|
5591
5594
|
*/
|
|
5592
5595
|
function getInertBodyHelper(defaultDoc) {
|
|
5593
|
-
|
|
5596
|
+
var inertDocumentHelper = new InertDocumentHelper(defaultDoc);
|
|
5597
|
+
return isDOMParserAvailable() ? new DOMParserHelper(inertDocumentHelper) : inertDocumentHelper;
|
|
5594
5598
|
}
|
|
5595
5599
|
/**
|
|
5596
5600
|
* Uses DOMParser to create and fill an inert body element.
|
|
5597
5601
|
* This is the default strategy used in browsers that support it.
|
|
5598
5602
|
*/
|
|
5599
5603
|
var DOMParserHelper = /** @class */ (function () {
|
|
5600
|
-
function DOMParserHelper() {
|
|
5604
|
+
function DOMParserHelper(inertDocumentHelper) {
|
|
5605
|
+
this.inertDocumentHelper = inertDocumentHelper;
|
|
5601
5606
|
}
|
|
5602
5607
|
DOMParserHelper.prototype.getInertBodyElement = function (html) {
|
|
5603
5608
|
// We add these extra elements to ensure that the rest of the content is parsed as expected
|
|
@@ -5609,6 +5614,12 @@
|
|
|
5609
5614
|
var body = new window.DOMParser()
|
|
5610
5615
|
.parseFromString(trustedHTMLFromString(html), 'text/html')
|
|
5611
5616
|
.body;
|
|
5617
|
+
if (body === null) {
|
|
5618
|
+
// In some browsers (e.g. Mozilla/5.0 iPad AppleWebKit Mobile) the `body` property only
|
|
5619
|
+
// becomes available in the following tick of the JS engine. In that case we fall back to
|
|
5620
|
+
// the `inertDocumentHelper` instead.
|
|
5621
|
+
return this.inertDocumentHelper.getInertBodyElement(html);
|
|
5622
|
+
}
|
|
5612
5623
|
body.removeChild(body.firstChild);
|
|
5613
5624
|
return body;
|
|
5614
5625
|
}
|
|
@@ -6397,6 +6408,42 @@
|
|
|
6397
6408
|
name: 'no-errors-schema'
|
|
6398
6409
|
};
|
|
6399
6410
|
|
|
6411
|
+
/**
|
|
6412
|
+
* @license
|
|
6413
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6414
|
+
*
|
|
6415
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6416
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6417
|
+
*/
|
|
6418
|
+
var END_COMMENT = /-->/g;
|
|
6419
|
+
var END_COMMENT_ESCAPED = '-\u200B-\u200B>';
|
|
6420
|
+
/**
|
|
6421
|
+
* Escape the content of the strings so that it can be safely inserted into a comment node.
|
|
6422
|
+
*
|
|
6423
|
+
* The issue is that HTML does not specify any way to escape comment end text inside the comment.
|
|
6424
|
+
* `<!-- The way you close a comment is with "-->". -->`. Above the `"-->"` is meant to be text not
|
|
6425
|
+
* an end to the comment. This can be created programmatically through DOM APIs.
|
|
6426
|
+
*
|
|
6427
|
+
* ```
|
|
6428
|
+
* div.innerHTML = div.innerHTML
|
|
6429
|
+
* ```
|
|
6430
|
+
*
|
|
6431
|
+
* One would expect that the above code would be safe to do, but it turns out that because comment
|
|
6432
|
+
* text is not escaped, the comment may contain text which will prematurely close the comment
|
|
6433
|
+
* opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
|
|
6434
|
+
* may contain such text and expect them to be safe.)
|
|
6435
|
+
*
|
|
6436
|
+
* This function escapes the comment text by looking for the closing char sequence `-->` and replace
|
|
6437
|
+
* it with `-_-_>` where the `_` is a zero width space `\u200B`. The result is that if a comment
|
|
6438
|
+
* contains `-->` text it will render normally but it will not cause the HTML parser to close the
|
|
6439
|
+
* comment.
|
|
6440
|
+
*
|
|
6441
|
+
* @param value text to make safe for comment node by escaping the comment close character sequence
|
|
6442
|
+
*/
|
|
6443
|
+
function escapeCommentText(value) {
|
|
6444
|
+
return value.replace(END_COMMENT, END_COMMENT_ESCAPED);
|
|
6445
|
+
}
|
|
6446
|
+
|
|
6400
6447
|
/**
|
|
6401
6448
|
* @license
|
|
6402
6449
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -7075,7 +7122,7 @@
|
|
|
7075
7122
|
ngDevMode && ngDevMode.rendererCreateComment++;
|
|
7076
7123
|
// isProceduralRenderer check is not needed because both `Renderer2` and `Renderer3` have the same
|
|
7077
7124
|
// method name.
|
|
7078
|
-
return renderer.createComment(value);
|
|
7125
|
+
return renderer.createComment(escapeCommentText(value));
|
|
7079
7126
|
}
|
|
7080
7127
|
/**
|
|
7081
7128
|
* Creates a native element from a tag name, using a renderer.
|
|
@@ -7411,12 +7458,12 @@
|
|
|
7411
7458
|
tCleanup[i].call(context);
|
|
7412
7459
|
}
|
|
7413
7460
|
}
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7461
|
+
}
|
|
7462
|
+
if (lCleanup !== null) {
|
|
7463
|
+
for (var i = lastLCleanupIndex + 1; i < lCleanup.length; i++) {
|
|
7464
|
+
var instanceCleanupFn = lCleanup[i];
|
|
7465
|
+
ngDevMode && assertFunction(instanceCleanupFn, 'Expecting instance cleanup function.');
|
|
7466
|
+
instanceCleanupFn();
|
|
7420
7467
|
}
|
|
7421
7468
|
lView[CLEANUP] = null;
|
|
7422
7469
|
}
|
|
@@ -9980,19 +10027,19 @@
|
|
|
9980
10027
|
* is `null` and the function is store in `LView` (rather than it `TView`).
|
|
9981
10028
|
*/
|
|
9982
10029
|
function storeCleanupWithContext(tView, lView, context, cleanupFn) {
|
|
9983
|
-
var lCleanup =
|
|
10030
|
+
var lCleanup = getOrCreateLViewCleanup(lView);
|
|
9984
10031
|
if (context === null) {
|
|
9985
10032
|
// If context is null that this is instance specific callback. These callbacks can only be
|
|
9986
10033
|
// inserted after template shared instances. For this reason in ngDevMode we freeze the TView.
|
|
9987
10034
|
if (ngDevMode) {
|
|
9988
|
-
Object.freeze(
|
|
10035
|
+
Object.freeze(getOrCreateTViewCleanup(tView));
|
|
9989
10036
|
}
|
|
9990
10037
|
lCleanup.push(cleanupFn);
|
|
9991
10038
|
}
|
|
9992
10039
|
else {
|
|
9993
10040
|
lCleanup.push(context);
|
|
9994
10041
|
if (tView.firstCreatePass) {
|
|
9995
|
-
|
|
10042
|
+
getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
|
|
9996
10043
|
}
|
|
9997
10044
|
}
|
|
9998
10045
|
}
|
|
@@ -10225,7 +10272,7 @@
|
|
|
10225
10272
|
}
|
|
10226
10273
|
}
|
|
10227
10274
|
else {
|
|
10228
|
-
var textContent = "bindings=" + JSON.stringify((_a = {}, _a[attrName] = debugValue, _a), null, 2);
|
|
10275
|
+
var textContent = escapeCommentText("bindings=" + JSON.stringify((_a = {}, _a[attrName] = debugValue, _a), null, 2));
|
|
10229
10276
|
if (isProceduralRenderer(renderer)) {
|
|
10230
10277
|
renderer.setValue(element, textContent);
|
|
10231
10278
|
}
|
|
@@ -11075,11 +11122,11 @@
|
|
|
11075
11122
|
}
|
|
11076
11123
|
}
|
|
11077
11124
|
var CLEAN_PROMISE = _CLEAN_PROMISE;
|
|
11078
|
-
function
|
|
11125
|
+
function getOrCreateLViewCleanup(view) {
|
|
11079
11126
|
// top level variables should not be exported for performance reasons (PERF_NOTES.md)
|
|
11080
11127
|
return view[CLEANUP] || (view[CLEANUP] = ngDevMode ? new LCleanup() : []);
|
|
11081
11128
|
}
|
|
11082
|
-
function
|
|
11129
|
+
function getOrCreateTViewCleanup(tView) {
|
|
11083
11130
|
return tView.cleanup || (tView.cleanup = ngDevMode ? new TCleanup() : []);
|
|
11084
11131
|
}
|
|
11085
11132
|
/**
|
|
@@ -15380,11 +15427,11 @@
|
|
|
15380
15427
|
if (useCapture === void 0) { useCapture = false; }
|
|
15381
15428
|
var isTNodeDirectiveHost = isDirectiveHost(tNode);
|
|
15382
15429
|
var firstCreatePass = tView.firstCreatePass;
|
|
15383
|
-
var tCleanup = firstCreatePass &&
|
|
15430
|
+
var tCleanup = firstCreatePass && getOrCreateTViewCleanup(tView);
|
|
15384
15431
|
// When the ɵɵlistener instruction was generated and is executed we know that there is either a
|
|
15385
15432
|
// native listener or a directive output on this element. As such we we know that we will have to
|
|
15386
15433
|
// register a listener and store its cleanup function on LView.
|
|
15387
|
-
var lCleanup =
|
|
15434
|
+
var lCleanup = getOrCreateLViewCleanup(lView);
|
|
15388
15435
|
ngDevMode && assertTNodeType(tNode, 3 /* AnyRNode */ | 12 /* AnyContainer */);
|
|
15389
15436
|
var processOutputs = true;
|
|
15390
15437
|
// add native event listener - applicable to elements only
|
|
@@ -21678,7 +21725,7 @@
|
|
|
21678
21725
|
/**
|
|
21679
21726
|
* @publicApi
|
|
21680
21727
|
*/
|
|
21681
|
-
var VERSION = new Version('11.0.
|
|
21728
|
+
var VERSION = new Version('11.0.8');
|
|
21682
21729
|
|
|
21683
21730
|
/**
|
|
21684
21731
|
* @license
|
|
@@ -22851,7 +22898,7 @@
|
|
|
22851
22898
|
this._lView = _lView;
|
|
22852
22899
|
this._cdRefInjectingView = _cdRefInjectingView;
|
|
22853
22900
|
this._appRef = null;
|
|
22854
|
-
this.
|
|
22901
|
+
this._attachedToViewContainer = false;
|
|
22855
22902
|
}
|
|
22856
22903
|
Object.defineProperty(ViewRef.prototype, "rootNodes", {
|
|
22857
22904
|
get: function () {
|
|
@@ -22880,12 +22927,19 @@
|
|
|
22880
22927
|
if (this._appRef) {
|
|
22881
22928
|
this._appRef.detachView(this);
|
|
22882
22929
|
}
|
|
22883
|
-
else if (this.
|
|
22884
|
-
var
|
|
22885
|
-
if (
|
|
22886
|
-
|
|
22930
|
+
else if (this._attachedToViewContainer) {
|
|
22931
|
+
var parent = this._lView[PARENT];
|
|
22932
|
+
if (isLContainer(parent)) {
|
|
22933
|
+
var viewRefs = parent[VIEW_REFS];
|
|
22934
|
+
var index = viewRefs ? viewRefs.indexOf(this) : -1;
|
|
22935
|
+
if (index > -1) {
|
|
22936
|
+
ngDevMode &&
|
|
22937
|
+
assertEqual(index, parent.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, 'An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array.');
|
|
22938
|
+
detachView(parent, index);
|
|
22939
|
+
removeFromArray(viewRefs, index);
|
|
22940
|
+
}
|
|
22887
22941
|
}
|
|
22888
|
-
this.
|
|
22942
|
+
this._attachedToViewContainer = false;
|
|
22889
22943
|
}
|
|
22890
22944
|
destroyLView(this._lView[TVIEW], this._lView);
|
|
22891
22945
|
};
|
|
@@ -23077,18 +23131,18 @@
|
|
|
23077
23131
|
ViewRef.prototype.checkNoChanges = function () {
|
|
23078
23132
|
checkNoChangesInternal(this._lView[TVIEW], this._lView, this.context);
|
|
23079
23133
|
};
|
|
23080
|
-
ViewRef.prototype.attachToViewContainerRef = function (
|
|
23134
|
+
ViewRef.prototype.attachToViewContainerRef = function () {
|
|
23081
23135
|
if (this._appRef) {
|
|
23082
23136
|
throw new Error('This view is already attached directly to the ApplicationRef!');
|
|
23083
23137
|
}
|
|
23084
|
-
this.
|
|
23138
|
+
this._attachedToViewContainer = true;
|
|
23085
23139
|
};
|
|
23086
23140
|
ViewRef.prototype.detachFromAppRef = function () {
|
|
23087
23141
|
this._appRef = null;
|
|
23088
23142
|
renderDetachView(this._lView[TVIEW], this._lView);
|
|
23089
23143
|
};
|
|
23090
23144
|
ViewRef.prototype.attachToAppRef = function (appRef) {
|
|
23091
|
-
if (this.
|
|
23145
|
+
if (this._attachedToViewContainer) {
|
|
23092
23146
|
throw new Error('This view is already attached to a ViewContainer!');
|
|
23093
23147
|
}
|
|
23094
23148
|
this._appRef = appRef;
|
|
@@ -23500,7 +23554,7 @@
|
|
|
23500
23554
|
if (parentRNode !== null) {
|
|
23501
23555
|
addViewToContainer(tView, lContainer[T_HOST], renderer, lView, parentRNode, beforeNode);
|
|
23502
23556
|
}
|
|
23503
|
-
viewRef.attachToViewContainerRef(
|
|
23557
|
+
viewRef.attachToViewContainerRef();
|
|
23504
23558
|
addToArray(getOrCreateViewRefs(lContainer), adjustedIdx, viewRef);
|
|
23505
23559
|
return viewRef;
|
|
23506
23560
|
};
|
|
@@ -29295,6 +29349,11 @@
|
|
|
29295
29349
|
if (_runModeLocked) {
|
|
29296
29350
|
throw new Error('Cannot enable prod mode after platform setup.');
|
|
29297
29351
|
}
|
|
29352
|
+
// The below check is there so when ngDevMode is set via terser
|
|
29353
|
+
// `global['ngDevMode'] = false;` is also dropped.
|
|
29354
|
+
if (typeof ngDevMode === undefined || !!ngDevMode) {
|
|
29355
|
+
_global['ngDevMode'] = false;
|
|
29356
|
+
}
|
|
29298
29357
|
_devMode = false;
|
|
29299
29358
|
}
|
|
29300
29359
|
|
|
@@ -29387,7 +29446,7 @@
|
|
|
29387
29446
|
}
|
|
29388
29447
|
/**
|
|
29389
29448
|
* Creates a factory for a platform. Can be used to provide or override `Providers` specific to
|
|
29390
|
-
* your
|
|
29449
|
+
* your application's runtime needs, such as `PLATFORM_INITIALIZER` and `PLATFORM_ID`.
|
|
29391
29450
|
* @param parentPlatformFactory Another platform factory to modify. Allows you to compose factories
|
|
29392
29451
|
* to build up configurations that might be required by different libraries or parts of the
|
|
29393
29452
|
* application.
|
|
@@ -32928,7 +32987,7 @@
|
|
|
32928
32987
|
var el = asElementData(view, elDef.nodeIndex).renderElement;
|
|
32929
32988
|
if (!elDef.element.name) {
|
|
32930
32989
|
// a comment.
|
|
32931
|
-
view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
|
|
32990
|
+
view.renderer.setValue(el, escapeCommentText("bindings=" + JSON.stringify(bindingValues, null, 2)));
|
|
32932
32991
|
}
|
|
32933
32992
|
else {
|
|
32934
32993
|
// a regular element.
|
|
@@ -33217,7 +33276,7 @@
|
|
|
33217
33276
|
return el;
|
|
33218
33277
|
};
|
|
33219
33278
|
DebugRenderer2.prototype.createComment = function (value) {
|
|
33220
|
-
var comment = this.delegate.createComment(value);
|
|
33279
|
+
var comment = this.delegate.createComment(escapeCommentText(value));
|
|
33221
33280
|
var debugCtx = this.createDebugContext(comment);
|
|
33222
33281
|
if (debugCtx) {
|
|
33223
33282
|
indexDebugNode(new DebugNode__PRE_R3__(comment, null, debugCtx));
|