@angular/core 13.2.0-rc.1 → 13.2.3
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/core.d.ts +86 -105
- package/esm2020/src/application_ref.mjs +3 -22
- package/esm2020/src/debug/debug_node.mjs +128 -45
- package/esm2020/src/di/r3_injector.mjs +5 -15
- package/esm2020/src/di/reflective_injector.mjs +1 -1
- package/esm2020/src/errors.mjs +22 -5
- package/esm2020/src/linker/template_ref.mjs +4 -13
- package/esm2020/src/linker/view_container_ref.mjs +26 -17
- package/esm2020/src/metadata/directives.mjs +14 -5
- package/esm2020/src/render3/component_ref.mjs +20 -3
- package/esm2020/src/render3/instructions/element.mjs +7 -1
- package/esm2020/src/render3/instructions/element_container.mjs +7 -1
- package/esm2020/src/render3/instructions/shared.mjs +2 -2
- package/esm2020/src/render3/interfaces/injector.mjs +1 -1
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/src/zone/ng_zone.mjs +3 -2
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/esm2020/testing/src/r3_test_bed.mjs +6 -1
- package/fesm2015/core.mjs +229 -149
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +6 -1
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +229 -149
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +6 -1
- package/fesm2020/testing.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/migrations/router-link-empty-expression/index.js +1 -1
- package/schematics/migrations/typed-forms/index.js +2 -2
- package/schematics/migrations.json +0 -5
- package/testing/testing.d.ts +1 -1
- package/esm2020/src/render3/chained_injector.mjs +0 -32
package/fesm2020/core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.2.
|
|
2
|
+
* @license Angular v13.2.3
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -152,20 +152,37 @@ const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';
|
|
|
152
152
|
* Use of this source code is governed by an MIT-style license that can be
|
|
153
153
|
* found in the LICENSE file at https://angular.io/license
|
|
154
154
|
*/
|
|
155
|
+
/**
|
|
156
|
+
* Class that represents a runtime error.
|
|
157
|
+
* Formats and outputs the error message in a consistent way.
|
|
158
|
+
*
|
|
159
|
+
* Example:
|
|
160
|
+
* ```
|
|
161
|
+
* throw new RuntimeError(
|
|
162
|
+
* RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,
|
|
163
|
+
* ngDevMode && 'Injector has already been destroyed.');
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* Note: the `message` argument contains a descriptive error message as a string in development
|
|
167
|
+
* mode (when the `ngDevMode` is defined). In production mode (after tree-shaking pass), the
|
|
168
|
+
* `message` argument becomes `false`, thus we account for it in the typings and the runtime logic.
|
|
169
|
+
*/
|
|
155
170
|
class RuntimeError extends Error {
|
|
156
171
|
constructor(code, message) {
|
|
157
172
|
super(formatRuntimeError(code, message));
|
|
158
173
|
this.code = code;
|
|
159
174
|
}
|
|
160
175
|
}
|
|
161
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Called to format a runtime error.
|
|
178
|
+
* See additional info on the `message` argument type in the `RuntimeError` class description.
|
|
179
|
+
*/
|
|
162
180
|
function formatRuntimeError(code, message) {
|
|
163
|
-
const codeAsNumber = code;
|
|
164
181
|
// Error code might be a negative number, which is a special marker that instructs the logic to
|
|
165
182
|
// generate a link to the error details page on angular.io.
|
|
166
|
-
const fullCode = `NG0${Math.abs(
|
|
183
|
+
const fullCode = `NG0${Math.abs(code)}`;
|
|
167
184
|
let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
|
|
168
|
-
if (ngDevMode &&
|
|
185
|
+
if (ngDevMode && code < 0) {
|
|
169
186
|
errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
|
|
170
187
|
}
|
|
171
188
|
return errorMessage;
|
|
@@ -10392,7 +10409,7 @@ function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
|
|
|
10392
10409
|
for (let i = 0; i < localRefs.length; i += 2) {
|
|
10393
10410
|
const index = exportsMap[localRefs[i + 1]];
|
|
10394
10411
|
if (index == null)
|
|
10395
|
-
throw new RuntimeError(-301 /* EXPORT_NOT_FOUND */, `Export of name '${localRefs[i + 1]}' not found!`);
|
|
10412
|
+
throw new RuntimeError(-301 /* EXPORT_NOT_FOUND */, ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`);
|
|
10396
10413
|
localNames.push(localRefs[i], index);
|
|
10397
10414
|
}
|
|
10398
10415
|
}
|
|
@@ -11318,10 +11335,7 @@ class R3Injector {
|
|
|
11318
11335
|
}
|
|
11319
11336
|
assertNotDestroyed() {
|
|
11320
11337
|
if (this._destroyed) {
|
|
11321
|
-
|
|
11322
|
-
'Injector has already been destroyed.' :
|
|
11323
|
-
'';
|
|
11324
|
-
throw new RuntimeError(205 /* INJECTOR_ALREADY_DESTROYED */, errorMessage);
|
|
11338
|
+
throw new RuntimeError(205 /* INJECTOR_ALREADY_DESTROYED */, ngDevMode && 'Injector has already been destroyed.');
|
|
11325
11339
|
}
|
|
11326
11340
|
}
|
|
11327
11341
|
/**
|
|
@@ -11485,28 +11499,21 @@ function injectableDefOrInjectorDefFactory(token) {
|
|
|
11485
11499
|
// InjectionTokens should have an injectable def (ɵprov) and thus should be handled above.
|
|
11486
11500
|
// If it's missing that, it's an error.
|
|
11487
11501
|
if (token instanceof InjectionToken) {
|
|
11488
|
-
|
|
11489
|
-
`Token ${stringify(token)} is missing a ɵprov definition.` :
|
|
11490
|
-
'';
|
|
11491
|
-
throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
|
|
11502
|
+
throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, ngDevMode && `Token ${stringify(token)} is missing a ɵprov definition.`);
|
|
11492
11503
|
}
|
|
11493
11504
|
// Undecorated types can sometimes be created if they have no constructor arguments.
|
|
11494
11505
|
if (token instanceof Function) {
|
|
11495
11506
|
return getUndecoratedInjectableFactory(token);
|
|
11496
11507
|
}
|
|
11497
11508
|
// There was no way to resolve a factory for this token.
|
|
11498
|
-
|
|
11499
|
-
throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
|
|
11509
|
+
throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, ngDevMode && 'unreachable');
|
|
11500
11510
|
}
|
|
11501
11511
|
function getUndecoratedInjectableFactory(token) {
|
|
11502
11512
|
// If the token has parameters then it has dependencies that we cannot resolve implicitly.
|
|
11503
11513
|
const paramLength = token.length;
|
|
11504
11514
|
if (paramLength > 0) {
|
|
11505
11515
|
const args = newArray(paramLength, '?');
|
|
11506
|
-
|
|
11507
|
-
`Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).` :
|
|
11508
|
-
'';
|
|
11509
|
-
throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
|
|
11516
|
+
throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, ngDevMode && `Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).`);
|
|
11510
11517
|
}
|
|
11511
11518
|
// The constructor function appears to have no parameters.
|
|
11512
11519
|
// This might be because it inherits from a super-class. In which case, use an injectable
|
|
@@ -14499,6 +14506,7 @@ function elementStartFirstCreatePass(index, tView, lView, native, name, attrsInd
|
|
|
14499
14506
|
* @param name Name of the DOM Node
|
|
14500
14507
|
* @param attrsIndex Index of the element's attributes in the `consts` array.
|
|
14501
14508
|
* @param localRefsIndex Index of the element's local references in the `consts` array.
|
|
14509
|
+
* @returns This function returns itself so that it may be chained.
|
|
14502
14510
|
*
|
|
14503
14511
|
* Attributes and localRefs are passed as an array of strings where elements with an even index
|
|
14504
14512
|
* hold an attribute name and elements with an odd index hold an attribute value, ex.:
|
|
@@ -14550,9 +14558,11 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
|
|
|
14550
14558
|
if (localRefsIndex !== null) {
|
|
14551
14559
|
saveResolvedLocalsInData(lView, tNode);
|
|
14552
14560
|
}
|
|
14561
|
+
return ɵɵelementStart;
|
|
14553
14562
|
}
|
|
14554
14563
|
/**
|
|
14555
14564
|
* Mark the end of the element.
|
|
14565
|
+
* @returns This function returns itself so that it may be chained.
|
|
14556
14566
|
*
|
|
14557
14567
|
* @codeGenApi
|
|
14558
14568
|
*/
|
|
@@ -14583,6 +14593,7 @@ function ɵɵelementEnd() {
|
|
|
14583
14593
|
if (tNode.stylesWithoutHost != null && hasStyleInput(tNode)) {
|
|
14584
14594
|
setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.stylesWithoutHost, false);
|
|
14585
14595
|
}
|
|
14596
|
+
return ɵɵelementEnd;
|
|
14586
14597
|
}
|
|
14587
14598
|
/**
|
|
14588
14599
|
* Creates an empty element using {@link elementStart} and {@link elementEnd}
|
|
@@ -14591,12 +14602,14 @@ function ɵɵelementEnd() {
|
|
|
14591
14602
|
* @param name Name of the DOM Node
|
|
14592
14603
|
* @param attrsIndex Index of the element's attributes in the `consts` array.
|
|
14593
14604
|
* @param localRefsIndex Index of the element's local references in the `consts` array.
|
|
14605
|
+
* @returns This function returns itself so that it may be chained.
|
|
14594
14606
|
*
|
|
14595
14607
|
* @codeGenApi
|
|
14596
14608
|
*/
|
|
14597
14609
|
function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
|
14598
14610
|
ɵɵelementStart(index, name, attrsIndex, localRefsIndex);
|
|
14599
14611
|
ɵɵelementEnd();
|
|
14612
|
+
return ɵɵelement;
|
|
14600
14613
|
}
|
|
14601
14614
|
function logUnknownElementError(tView, element, tNode, hasDirectives) {
|
|
14602
14615
|
const schemas = tView.schemas;
|
|
@@ -14665,6 +14678,7 @@ function elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, l
|
|
|
14665
14678
|
* @param index Index of the element in the LView array
|
|
14666
14679
|
* @param attrsIndex Index of the container attributes in the `consts` array.
|
|
14667
14680
|
* @param localRefsIndex Index of the container's local references in the `consts` array.
|
|
14681
|
+
* @returns This function returns itself so that it may be chained.
|
|
14668
14682
|
*
|
|
14669
14683
|
* Even if this instruction accepts a set of attributes no actual attribute values are propagated to
|
|
14670
14684
|
* the DOM (as a comment node can't have attributes). Attributes are here only for directive
|
|
@@ -14695,9 +14709,11 @@ function ɵɵelementContainerStart(index, attrsIndex, localRefsIndex) {
|
|
|
14695
14709
|
if (localRefsIndex != null) {
|
|
14696
14710
|
saveResolvedLocalsInData(lView, tNode);
|
|
14697
14711
|
}
|
|
14712
|
+
return ɵɵelementContainerStart;
|
|
14698
14713
|
}
|
|
14699
14714
|
/**
|
|
14700
14715
|
* Mark the end of the <ng-container>.
|
|
14716
|
+
* @returns This function returns itself so that it may be chained.
|
|
14701
14717
|
*
|
|
14702
14718
|
* @codeGenApi
|
|
14703
14719
|
*/
|
|
@@ -14719,6 +14735,7 @@ function ɵɵelementContainerEnd() {
|
|
|
14719
14735
|
tView.queries.elementEnd(currentTNode);
|
|
14720
14736
|
}
|
|
14721
14737
|
}
|
|
14738
|
+
return ɵɵelementContainerEnd;
|
|
14722
14739
|
}
|
|
14723
14740
|
/**
|
|
14724
14741
|
* Creates an empty logical container using {@link elementContainerStart}
|
|
@@ -14727,12 +14744,14 @@ function ɵɵelementContainerEnd() {
|
|
|
14727
14744
|
* @param index Index of the element in the LView array
|
|
14728
14745
|
* @param attrsIndex Index of the container attributes in the `consts` array.
|
|
14729
14746
|
* @param localRefsIndex Index of the container's local references in the `consts` array.
|
|
14747
|
+
* @returns This function returns itself so that it may be chained.
|
|
14730
14748
|
*
|
|
14731
14749
|
* @codeGenApi
|
|
14732
14750
|
*/
|
|
14733
14751
|
function ɵɵelementContainer(index, attrsIndex, localRefsIndex) {
|
|
14734
14752
|
ɵɵelementContainerStart(index, attrsIndex, localRefsIndex);
|
|
14735
14753
|
ɵɵelementContainerEnd();
|
|
14754
|
+
return ɵɵelementContainer;
|
|
14736
14755
|
}
|
|
14737
14756
|
|
|
14738
14757
|
/**
|
|
@@ -21083,7 +21102,7 @@ class Version {
|
|
|
21083
21102
|
/**
|
|
21084
21103
|
* @publicApi
|
|
21085
21104
|
*/
|
|
21086
|
-
const VERSION = new Version('13.2.
|
|
21105
|
+
const VERSION = new Version('13.2.3');
|
|
21087
21106
|
|
|
21088
21107
|
/**
|
|
21089
21108
|
* @license
|
|
@@ -21111,37 +21130,6 @@ const VERSION = new Version('13.2.0-rc.1');
|
|
|
21111
21130
|
// - mod2.injector.get(token, default)
|
|
21112
21131
|
const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
|
|
21113
21132
|
|
|
21114
|
-
/**
|
|
21115
|
-
* @license
|
|
21116
|
-
* Copyright Google LLC All Rights Reserved.
|
|
21117
|
-
*
|
|
21118
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
21119
|
-
* found in the LICENSE file at https://angular.io/license
|
|
21120
|
-
*/
|
|
21121
|
-
/**
|
|
21122
|
-
* Injector that looks up a value using a specific injector, before falling back to the module
|
|
21123
|
-
* injector. Used primarily when creating components or embedded views dynamically.
|
|
21124
|
-
*/
|
|
21125
|
-
class ChainedInjector {
|
|
21126
|
-
constructor(injector, parentInjector) {
|
|
21127
|
-
this.injector = injector;
|
|
21128
|
-
this.parentInjector = parentInjector;
|
|
21129
|
-
}
|
|
21130
|
-
get(token, notFoundValue, flags) {
|
|
21131
|
-
const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
|
|
21132
|
-
if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
|
|
21133
|
-
notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
|
|
21134
|
-
// Return the value from the root element injector when
|
|
21135
|
-
// - it provides it
|
|
21136
|
-
// (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
|
|
21137
|
-
// - the module injector should not be checked
|
|
21138
|
-
// (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
|
|
21139
|
-
return value;
|
|
21140
|
-
}
|
|
21141
|
-
return this.parentInjector.get(token, notFoundValue, flags);
|
|
21142
|
-
}
|
|
21143
|
-
}
|
|
21144
|
-
|
|
21145
21133
|
/**
|
|
21146
21134
|
* @license
|
|
21147
21135
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -21527,6 +21515,23 @@ const SCHEDULER = new InjectionToken('SCHEDULER_TOKEN', {
|
|
|
21527
21515
|
providedIn: 'root',
|
|
21528
21516
|
factory: () => defaultScheduler,
|
|
21529
21517
|
});
|
|
21518
|
+
function createChainedInjector(rootViewInjector, moduleInjector) {
|
|
21519
|
+
return {
|
|
21520
|
+
get: (token, notFoundValue, flags) => {
|
|
21521
|
+
const value = rootViewInjector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
|
|
21522
|
+
if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
|
|
21523
|
+
notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
|
|
21524
|
+
// Return the value from the root element injector when
|
|
21525
|
+
// - it provides it
|
|
21526
|
+
// (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
|
|
21527
|
+
// - the module injector should not be checked
|
|
21528
|
+
// (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
|
|
21529
|
+
return value;
|
|
21530
|
+
}
|
|
21531
|
+
return moduleInjector.get(token, notFoundValue, flags);
|
|
21532
|
+
}
|
|
21533
|
+
};
|
|
21534
|
+
}
|
|
21530
21535
|
/**
|
|
21531
21536
|
* Render3 implementation of {@link viewEngine_ComponentFactory}.
|
|
21532
21537
|
*/
|
|
@@ -21553,7 +21558,7 @@ class ComponentFactory extends ComponentFactory$1 {
|
|
|
21553
21558
|
}
|
|
21554
21559
|
create(injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
|
21555
21560
|
ngModule = ngModule || this.ngModule;
|
|
21556
|
-
const rootViewInjector = ngModule ?
|
|
21561
|
+
const rootViewInjector = ngModule ? createChainedInjector(injector, ngModule.injector) : injector;
|
|
21557
21562
|
const rendererFactory = rootViewInjector.get(RendererFactory2, domRendererFactory3);
|
|
21558
21563
|
const sanitizer = rootViewInjector.get(Sanitizer, null);
|
|
21559
21564
|
const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
|
|
@@ -22688,9 +22693,9 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
|
|
|
22688
22693
|
this._declarationTContainer = _declarationTContainer;
|
|
22689
22694
|
this.elementRef = elementRef;
|
|
22690
22695
|
}
|
|
22691
|
-
createEmbeddedView(context
|
|
22696
|
+
createEmbeddedView(context) {
|
|
22692
22697
|
const embeddedTView = this._declarationTContainer.tViews;
|
|
22693
|
-
const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* CheckAlways */, null, embeddedTView.declTNode, null, null, null,
|
|
22698
|
+
const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* CheckAlways */, null, embeddedTView.declTNode, null, null, null, null);
|
|
22694
22699
|
const declarationLContainer = this._declarationLView[this._declarationTContainer.index];
|
|
22695
22700
|
ngDevMode && assertLContainer(declarationLContainer);
|
|
22696
22701
|
embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
|
|
@@ -22702,14 +22707,6 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
|
|
|
22702
22707
|
return new ViewRef$1(embeddedLView);
|
|
22703
22708
|
}
|
|
22704
22709
|
};
|
|
22705
|
-
function createEmbeddedViewInjector(embeddedViewInjector, declarationViewInjector) {
|
|
22706
|
-
if (!embeddedViewInjector) {
|
|
22707
|
-
return null;
|
|
22708
|
-
}
|
|
22709
|
-
return declarationViewInjector ?
|
|
22710
|
-
new ChainedInjector(embeddedViewInjector, declarationViewInjector) :
|
|
22711
|
-
embeddedViewInjector;
|
|
22712
|
-
}
|
|
22713
22710
|
/**
|
|
22714
22711
|
* Creates a TemplateRef given a node.
|
|
22715
22712
|
*
|
|
@@ -22814,17 +22811,8 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
|
|
|
22814
22811
|
get length() {
|
|
22815
22812
|
return this._lContainer.length - CONTAINER_HEADER_OFFSET;
|
|
22816
22813
|
}
|
|
22817
|
-
createEmbeddedView(templateRef, context,
|
|
22818
|
-
|
|
22819
|
-
let injector;
|
|
22820
|
-
if (typeof indexOrOptions === 'number') {
|
|
22821
|
-
index = indexOrOptions;
|
|
22822
|
-
}
|
|
22823
|
-
else if (indexOrOptions != null) {
|
|
22824
|
-
index = indexOrOptions.index;
|
|
22825
|
-
injector = indexOrOptions.injector;
|
|
22826
|
-
}
|
|
22827
|
-
const viewRef = templateRef.createEmbeddedView(context || {}, injector);
|
|
22814
|
+
createEmbeddedView(templateRef, context, index) {
|
|
22815
|
+
const viewRef = templateRef.createEmbeddedView(context || {});
|
|
22828
22816
|
this.insert(viewRef, index);
|
|
22829
22817
|
return viewRef;
|
|
22830
22818
|
}
|
|
@@ -22865,11 +22853,29 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
|
|
|
22865
22853
|
componentFactoryOrType :
|
|
22866
22854
|
new ComponentFactory(getComponentDef(componentFactoryOrType));
|
|
22867
22855
|
const contextInjector = injector || this.parentInjector;
|
|
22868
|
-
|
|
22869
|
-
|
|
22870
|
-
//
|
|
22871
|
-
//
|
|
22872
|
-
|
|
22856
|
+
// If an `NgModuleRef` is not provided explicitly, try retrieving it from the DI tree.
|
|
22857
|
+
if (!ngModuleRef && componentFactory.ngModule == null) {
|
|
22858
|
+
// For the `ComponentFactory` case, entering this logic is very unlikely, since we expect that
|
|
22859
|
+
// an instance of a `ComponentFactory`, resolved via `ComponentFactoryResolver` would have an
|
|
22860
|
+
// `ngModule` field. This is possible in some test scenarios and potentially in some JIT-based
|
|
22861
|
+
// use-cases. For the `ComponentFactory` case we preserve backwards-compatibility and try
|
|
22862
|
+
// using a provided injector first, then fall back to the parent injector of this
|
|
22863
|
+
// `ViewContainerRef` instance.
|
|
22864
|
+
//
|
|
22865
|
+
// For the factory-less case, it's critical to establish a connection with the module
|
|
22866
|
+
// injector tree (by retrieving an instance of an `NgModuleRef` and accessing its injector),
|
|
22867
|
+
// so that a component can use DI tokens provided in MgModules. For this reason, we can not
|
|
22868
|
+
// rely on the provided injector, since it might be detached from the DI tree (for example, if
|
|
22869
|
+
// it was created via `Injector.create` without specifying a parent injector, or if an
|
|
22870
|
+
// injector is retrieved from an `NgModuleRef` created via `createNgModuleRef` using an
|
|
22871
|
+
// NgModule outside of a module tree). Instead, we always use `ViewContainerRef`'s parent
|
|
22872
|
+
// injector, which is normally connected to the DI tree, which includes module injector
|
|
22873
|
+
// subtree.
|
|
22874
|
+
const _injector = isComponentFactory ? contextInjector : this.parentInjector;
|
|
22875
|
+
// DO NOT REFACTOR. The code here used to have a `injector.get(NgModuleRef, null) ||
|
|
22876
|
+
// undefined` expression which seems to cause internal google apps to fail. This is documented
|
|
22877
|
+
// in the following internal bug issue: go/b/142967802
|
|
22878
|
+
const result = _injector.get(NgModuleRef$1, null);
|
|
22873
22879
|
if (result) {
|
|
22874
22880
|
ngModuleRef = result;
|
|
22875
22881
|
}
|
|
@@ -24605,19 +24611,20 @@ const HostBinding = makePropDecorator('HostBinding', (hostPropertyName) => ({ ho
|
|
|
24605
24611
|
*
|
|
24606
24612
|
* ```
|
|
24607
24613
|
*
|
|
24608
|
-
* The following example registers another DOM event handler that listens for key-press
|
|
24614
|
+
* The following example registers another DOM event handler that listens for `Enter` key-press
|
|
24615
|
+
* events on the global `window`.
|
|
24609
24616
|
* ``` ts
|
|
24610
24617
|
* import { HostListener, Component } from "@angular/core";
|
|
24611
24618
|
*
|
|
24612
24619
|
* @Component({
|
|
24613
24620
|
* selector: 'app',
|
|
24614
|
-
* template: `<h1>Hello, you have pressed
|
|
24615
|
-
* increment the counter.
|
|
24621
|
+
* template: `<h1>Hello, you have pressed enter {{counter}} number of times!</h1> Press enter key
|
|
24622
|
+
* to increment the counter.
|
|
24616
24623
|
* <button (click)="resetCounter()">Reset Counter</button>`
|
|
24617
24624
|
* })
|
|
24618
24625
|
* class AppComponent {
|
|
24619
24626
|
* counter = 0;
|
|
24620
|
-
* @HostListener('window:keydown', ['$event'])
|
|
24627
|
+
* @HostListener('window:keydown.enter', ['$event'])
|
|
24621
24628
|
* handleKeyDown(event: KeyboardEvent) {
|
|
24622
24629
|
* this.counter++;
|
|
24623
24630
|
* }
|
|
@@ -24626,6 +24633,14 @@ const HostBinding = makePropDecorator('HostBinding', (hostPropertyName) => ({ ho
|
|
|
24626
24633
|
* }
|
|
24627
24634
|
* }
|
|
24628
24635
|
* ```
|
|
24636
|
+
* The list of valid key names for `keydown` and `keyup` events
|
|
24637
|
+
* can be found here:
|
|
24638
|
+
* https://www.w3.org/TR/DOM-Level-3-Events-key/#named-key-attribute-values
|
|
24639
|
+
*
|
|
24640
|
+
* Note that keys can also be combined, e.g. `@HostListener('keydown.shift.a')`.
|
|
24641
|
+
*
|
|
24642
|
+
* The global target names that can be used to prefix an event name are
|
|
24643
|
+
* `document:`, `window:` and `body:`.
|
|
24629
24644
|
*
|
|
24630
24645
|
* @Annotation
|
|
24631
24646
|
* @publicApi
|
|
@@ -25354,7 +25369,8 @@ class NgZone {
|
|
|
25354
25369
|
forkInnerZoneWithAngularBehavior(self);
|
|
25355
25370
|
}
|
|
25356
25371
|
static isInAngularZone() {
|
|
25357
|
-
|
|
25372
|
+
// Zone needs to be checked, because this method might be called even when NoopNgZone is used.
|
|
25373
|
+
return typeof Zone !== 'undefined' && Zone.current.get('isAngularZone') === true;
|
|
25358
25374
|
}
|
|
25359
25375
|
static assertInAngularZone() {
|
|
25360
25376
|
if (!NgZone.isInAngularZone()) {
|
|
@@ -26028,26 +26044,7 @@ class PlatformRef {
|
|
|
26028
26044
|
this._destroyed = false;
|
|
26029
26045
|
}
|
|
26030
26046
|
/**
|
|
26031
|
-
* Creates an instance of an `@NgModule` for the given platform
|
|
26032
|
-
*
|
|
26033
|
-
* @usageNotes
|
|
26034
|
-
*
|
|
26035
|
-
* The following example creates the NgModule for a browser platform.
|
|
26036
|
-
*
|
|
26037
|
-
* ```typescript
|
|
26038
|
-
* my_module.ts:
|
|
26039
|
-
*
|
|
26040
|
-
* @NgModule({
|
|
26041
|
-
* imports: [BrowserModule]
|
|
26042
|
-
* })
|
|
26043
|
-
* class MyModule {}
|
|
26044
|
-
*
|
|
26045
|
-
* main.ts:
|
|
26046
|
-
* import {MyModuleNgFactory} from './my_module.ngfactory';
|
|
26047
|
-
* import {platformBrowser} from '@angular/platform-browser';
|
|
26048
|
-
*
|
|
26049
|
-
* let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
|
|
26050
|
-
* ```
|
|
26047
|
+
* Creates an instance of an `@NgModule` for the given platform.
|
|
26051
26048
|
*
|
|
26052
26049
|
* @deprecated Passing NgModule factories as the `PlatformRef.bootstrapModuleFactory` function
|
|
26053
26050
|
* argument is deprecated. Use the `PlatformRef.bootstrapModule` API instead.
|
|
@@ -26101,7 +26098,7 @@ class PlatformRef {
|
|
|
26101
26098
|
});
|
|
26102
26099
|
}
|
|
26103
26100
|
/**
|
|
26104
|
-
* Creates an instance of an `@NgModule` for a given platform
|
|
26101
|
+
* Creates an instance of an `@NgModule` for a given platform.
|
|
26105
26102
|
*
|
|
26106
26103
|
* @usageNotes
|
|
26107
26104
|
* ### Simple Example
|
|
@@ -26844,8 +26841,6 @@ var ng_module_factory_loader_impl = {};
|
|
|
26844
26841
|
* Use of this source code is governed by an MIT-style license that can be
|
|
26845
26842
|
* found in the LICENSE file at https://angular.io/license
|
|
26846
26843
|
*/
|
|
26847
|
-
// TODO(alxhub): recombine the interfaces and implementations here and move the docs back onto the
|
|
26848
|
-
// original classes.
|
|
26849
26844
|
/**
|
|
26850
26845
|
* @publicApi
|
|
26851
26846
|
*/
|
|
@@ -26861,43 +26856,88 @@ class DebugEventListener {
|
|
|
26861
26856
|
function asNativeElements(debugEls) {
|
|
26862
26857
|
return debugEls.map((el) => el.nativeElement);
|
|
26863
26858
|
}
|
|
26864
|
-
|
|
26859
|
+
/**
|
|
26860
|
+
* @publicApi
|
|
26861
|
+
*/
|
|
26862
|
+
class DebugNode {
|
|
26865
26863
|
constructor(nativeNode) {
|
|
26866
26864
|
this.nativeNode = nativeNode;
|
|
26867
26865
|
}
|
|
26866
|
+
/**
|
|
26867
|
+
* The `DebugElement` parent. Will be `null` if this is the root element.
|
|
26868
|
+
*/
|
|
26868
26869
|
get parent() {
|
|
26869
26870
|
const parent = this.nativeNode.parentNode;
|
|
26870
|
-
return parent ? new
|
|
26871
|
+
return parent ? new DebugElement(parent) : null;
|
|
26871
26872
|
}
|
|
26873
|
+
/**
|
|
26874
|
+
* The host dependency injector. For example, the root element's component instance injector.
|
|
26875
|
+
*/
|
|
26872
26876
|
get injector() {
|
|
26873
26877
|
return getInjector(this.nativeNode);
|
|
26874
26878
|
}
|
|
26879
|
+
/**
|
|
26880
|
+
* The element's own component instance, if it has one.
|
|
26881
|
+
*/
|
|
26875
26882
|
get componentInstance() {
|
|
26876
26883
|
const nativeElement = this.nativeNode;
|
|
26877
26884
|
return nativeElement &&
|
|
26878
26885
|
(getComponent$1(nativeElement) || getOwningComponent(nativeElement));
|
|
26879
26886
|
}
|
|
26887
|
+
/**
|
|
26888
|
+
* An object that provides parent context for this element. Often an ancestor component instance
|
|
26889
|
+
* that governs this element.
|
|
26890
|
+
*
|
|
26891
|
+
* When an element is repeated within *ngFor, the context is an `NgForOf` whose `$implicit`
|
|
26892
|
+
* property is the value of the row instance value. For example, the `hero` in `*ngFor="let hero
|
|
26893
|
+
* of heroes"`.
|
|
26894
|
+
*/
|
|
26880
26895
|
get context() {
|
|
26881
26896
|
return getComponent$1(this.nativeNode) || getContext(this.nativeNode);
|
|
26882
26897
|
}
|
|
26898
|
+
/**
|
|
26899
|
+
* The callbacks attached to the component's @Output properties and/or the element's event
|
|
26900
|
+
* properties.
|
|
26901
|
+
*/
|
|
26883
26902
|
get listeners() {
|
|
26884
26903
|
return getListeners(this.nativeNode).filter(listener => listener.type === 'dom');
|
|
26885
26904
|
}
|
|
26905
|
+
/**
|
|
26906
|
+
* Dictionary of objects associated with template local variables (e.g. #foo), keyed by the local
|
|
26907
|
+
* variable name.
|
|
26908
|
+
*/
|
|
26886
26909
|
get references() {
|
|
26887
26910
|
return getLocalRefs(this.nativeNode);
|
|
26888
26911
|
}
|
|
26912
|
+
/**
|
|
26913
|
+
* This component's injector lookup tokens. Includes the component itself plus the tokens that the
|
|
26914
|
+
* component lists in its providers metadata.
|
|
26915
|
+
*/
|
|
26889
26916
|
get providerTokens() {
|
|
26890
26917
|
return getInjectionTokens(this.nativeNode);
|
|
26891
26918
|
}
|
|
26892
26919
|
}
|
|
26893
|
-
|
|
26920
|
+
/**
|
|
26921
|
+
* @publicApi
|
|
26922
|
+
*
|
|
26923
|
+
* @see [Component testing scenarios](guide/testing-components-scenarios)
|
|
26924
|
+
* @see [Basics of testing components](guide/testing-components-basics)
|
|
26925
|
+
* @see [Testing utility APIs](guide/testing-utility-apis)
|
|
26926
|
+
*/
|
|
26927
|
+
class DebugElement extends DebugNode {
|
|
26894
26928
|
constructor(nativeNode) {
|
|
26895
26929
|
ngDevMode && assertDomNode(nativeNode);
|
|
26896
26930
|
super(nativeNode);
|
|
26897
26931
|
}
|
|
26932
|
+
/**
|
|
26933
|
+
* The underlying DOM element at the root of the component.
|
|
26934
|
+
*/
|
|
26898
26935
|
get nativeElement() {
|
|
26899
26936
|
return this.nativeNode.nodeType == Node.ELEMENT_NODE ? this.nativeNode : null;
|
|
26900
26937
|
}
|
|
26938
|
+
/**
|
|
26939
|
+
* The element tag name, if it is an element.
|
|
26940
|
+
*/
|
|
26901
26941
|
get name() {
|
|
26902
26942
|
const context = getLContext(this.nativeNode);
|
|
26903
26943
|
if (context !== null) {
|
|
@@ -26938,6 +26978,9 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
|
|
|
26938
26978
|
collectPropertyBindings(properties, tNode, lView, tData);
|
|
26939
26979
|
return properties;
|
|
26940
26980
|
}
|
|
26981
|
+
/**
|
|
26982
|
+
* A map of attribute names to attribute values for an element.
|
|
26983
|
+
*/
|
|
26941
26984
|
get attributes() {
|
|
26942
26985
|
const attributes = {};
|
|
26943
26986
|
const element = this.nativeElement;
|
|
@@ -26986,12 +27029,29 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
|
|
|
26986
27029
|
}
|
|
26987
27030
|
return attributes;
|
|
26988
27031
|
}
|
|
27032
|
+
/**
|
|
27033
|
+
* The inline styles of the DOM element.
|
|
27034
|
+
*
|
|
27035
|
+
* Will be `null` if there is no `style` property on the underlying DOM element.
|
|
27036
|
+
*
|
|
27037
|
+
* @see [ElementCSSInlineStyle](https://developer.mozilla.org/en-US/docs/Web/API/ElementCSSInlineStyle/style)
|
|
27038
|
+
*/
|
|
26989
27039
|
get styles() {
|
|
26990
27040
|
if (this.nativeElement && this.nativeElement.style) {
|
|
26991
27041
|
return this.nativeElement.style;
|
|
26992
27042
|
}
|
|
26993
27043
|
return {};
|
|
26994
27044
|
}
|
|
27045
|
+
/**
|
|
27046
|
+
* A map containing the class names on the element as keys.
|
|
27047
|
+
*
|
|
27048
|
+
* This map is derived from the `className` property of the DOM element.
|
|
27049
|
+
*
|
|
27050
|
+
* Note: The values of this object will always be `true`. The class key will not appear in the KV
|
|
27051
|
+
* object if it does not exist on the element.
|
|
27052
|
+
*
|
|
27053
|
+
* @see [Element.className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)
|
|
27054
|
+
*/
|
|
26995
27055
|
get classes() {
|
|
26996
27056
|
const result = {};
|
|
26997
27057
|
const element = this.nativeElement;
|
|
@@ -27001,15 +27061,23 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
|
|
|
27001
27061
|
classes.forEach((value) => result[value] = true);
|
|
27002
27062
|
return result;
|
|
27003
27063
|
}
|
|
27064
|
+
/**
|
|
27065
|
+
* The `childNodes` of the DOM element as a `DebugNode` array.
|
|
27066
|
+
*
|
|
27067
|
+
* @see [Node.childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes)
|
|
27068
|
+
*/
|
|
27004
27069
|
get childNodes() {
|
|
27005
27070
|
const childNodes = this.nativeNode.childNodes;
|
|
27006
27071
|
const children = [];
|
|
27007
27072
|
for (let i = 0; i < childNodes.length; i++) {
|
|
27008
27073
|
const element = childNodes[i];
|
|
27009
|
-
children.push(
|
|
27074
|
+
children.push(getDebugNode(element));
|
|
27010
27075
|
}
|
|
27011
27076
|
return children;
|
|
27012
27077
|
}
|
|
27078
|
+
/**
|
|
27079
|
+
* The immediate `DebugElement` children. Walk the tree by descending through `children`.
|
|
27080
|
+
*/
|
|
27013
27081
|
get children() {
|
|
27014
27082
|
const nativeElement = this.nativeElement;
|
|
27015
27083
|
if (!nativeElement)
|
|
@@ -27018,24 +27086,45 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
|
|
|
27018
27086
|
const children = [];
|
|
27019
27087
|
for (let i = 0; i < childNodes.length; i++) {
|
|
27020
27088
|
const element = childNodes[i];
|
|
27021
|
-
children.push(
|
|
27089
|
+
children.push(getDebugNode(element));
|
|
27022
27090
|
}
|
|
27023
27091
|
return children;
|
|
27024
27092
|
}
|
|
27093
|
+
/**
|
|
27094
|
+
* @returns the first `DebugElement` that matches the predicate at any depth in the subtree.
|
|
27095
|
+
*/
|
|
27025
27096
|
query(predicate) {
|
|
27026
27097
|
const results = this.queryAll(predicate);
|
|
27027
27098
|
return results[0] || null;
|
|
27028
27099
|
}
|
|
27100
|
+
/**
|
|
27101
|
+
* @returns All `DebugElement` matches for the predicate at any depth in the subtree.
|
|
27102
|
+
*/
|
|
27029
27103
|
queryAll(predicate) {
|
|
27030
27104
|
const matches = [];
|
|
27031
|
-
|
|
27105
|
+
_queryAll(this, predicate, matches, true);
|
|
27032
27106
|
return matches;
|
|
27033
27107
|
}
|
|
27108
|
+
/**
|
|
27109
|
+
* @returns All `DebugNode` matches for the predicate at any depth in the subtree.
|
|
27110
|
+
*/
|
|
27034
27111
|
queryAllNodes(predicate) {
|
|
27035
27112
|
const matches = [];
|
|
27036
|
-
|
|
27113
|
+
_queryAll(this, predicate, matches, false);
|
|
27037
27114
|
return matches;
|
|
27038
27115
|
}
|
|
27116
|
+
/**
|
|
27117
|
+
* Triggers the event by its name if there is a corresponding listener in the element's
|
|
27118
|
+
* `listeners` collection.
|
|
27119
|
+
*
|
|
27120
|
+
* If the event lacks a listener or there's some other problem, consider
|
|
27121
|
+
* calling `nativeElement.dispatchEvent(eventObject)`.
|
|
27122
|
+
*
|
|
27123
|
+
* @param eventName The name of the event to trigger
|
|
27124
|
+
* @param eventObj The _event object_ expected by the handler
|
|
27125
|
+
*
|
|
27126
|
+
* @see [Testing components scenarios](guide/testing-components-scenarios#trigger-event-handler)
|
|
27127
|
+
*/
|
|
27039
27128
|
triggerEventHandler(eventName, eventObj) {
|
|
27040
27129
|
const node = this.nativeNode;
|
|
27041
27130
|
const invokedListeners = [];
|
|
@@ -27094,11 +27183,11 @@ function isPrimitiveValue(value) {
|
|
|
27094
27183
|
return typeof value === 'string' || typeof value === 'boolean' || typeof value === 'number' ||
|
|
27095
27184
|
value === null;
|
|
27096
27185
|
}
|
|
27097
|
-
function
|
|
27186
|
+
function _queryAll(parentElement, predicate, matches, elementsOnly) {
|
|
27098
27187
|
const context = getLContext(parentElement.nativeNode);
|
|
27099
27188
|
if (context !== null) {
|
|
27100
27189
|
const parentTNode = context.lView[TVIEW].data[context.nodeIndex];
|
|
27101
|
-
|
|
27190
|
+
_queryNodeChildren(parentTNode, context.lView, predicate, matches, elementsOnly, parentElement.nativeNode);
|
|
27102
27191
|
}
|
|
27103
27192
|
else {
|
|
27104
27193
|
// If the context is null, then `parentElement` was either created with Renderer2 or native DOM
|
|
@@ -27116,26 +27205,26 @@ function _queryAllR3(parentElement, predicate, matches, elementsOnly) {
|
|
|
27116
27205
|
* @param elementsOnly whether only elements should be searched
|
|
27117
27206
|
* @param rootNativeNode the root native node on which predicate should not be matched
|
|
27118
27207
|
*/
|
|
27119
|
-
function
|
|
27208
|
+
function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, rootNativeNode) {
|
|
27120
27209
|
ngDevMode && assertTNodeForLView(tNode, lView);
|
|
27121
27210
|
const nativeNode = getNativeByTNodeOrNull(tNode, lView);
|
|
27122
27211
|
// For each type of TNode, specific logic is executed.
|
|
27123
27212
|
if (tNode.type & (3 /* AnyRNode */ | 8 /* ElementContainer */)) {
|
|
27124
27213
|
// Case 1: the TNode is an element
|
|
27125
27214
|
// The native node has to be checked.
|
|
27126
|
-
|
|
27215
|
+
_addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
|
|
27127
27216
|
if (isComponentHost(tNode)) {
|
|
27128
27217
|
// If the element is the host of a component, then all nodes in its view have to be processed.
|
|
27129
27218
|
// Note: the component's content (tNode.child) will be processed from the insertion points.
|
|
27130
27219
|
const componentView = getComponentLViewByIndex(tNode.index, lView);
|
|
27131
27220
|
if (componentView && componentView[TVIEW].firstChild) {
|
|
27132
|
-
|
|
27221
|
+
_queryNodeChildren(componentView[TVIEW].firstChild, componentView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27133
27222
|
}
|
|
27134
27223
|
}
|
|
27135
27224
|
else {
|
|
27136
27225
|
if (tNode.child) {
|
|
27137
27226
|
// Otherwise, its children have to be processed.
|
|
27138
|
-
|
|
27227
|
+
_queryNodeChildren(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27139
27228
|
}
|
|
27140
27229
|
// We also have to query the DOM directly in order to catch elements inserted through
|
|
27141
27230
|
// Renderer2. Note that this is __not__ optimal, because we're walking similar trees multiple
|
|
@@ -27151,16 +27240,16 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
|
|
|
27151
27240
|
// processed.
|
|
27152
27241
|
const nodeOrContainer = lView[tNode.index];
|
|
27153
27242
|
if (isLContainer(nodeOrContainer)) {
|
|
27154
|
-
|
|
27243
|
+
_queryNodeChildrenInContainer(nodeOrContainer, predicate, matches, elementsOnly, rootNativeNode);
|
|
27155
27244
|
}
|
|
27156
27245
|
}
|
|
27157
27246
|
else if (tNode.type & 4 /* Container */) {
|
|
27158
27247
|
// Case 2: the TNode is a container
|
|
27159
27248
|
// The native node has to be checked.
|
|
27160
27249
|
const lContainer = lView[tNode.index];
|
|
27161
|
-
|
|
27250
|
+
_addQueryMatch(lContainer[NATIVE], predicate, matches, elementsOnly, rootNativeNode);
|
|
27162
27251
|
// Each view inside the container has to be processed.
|
|
27163
|
-
|
|
27252
|
+
_queryNodeChildrenInContainer(lContainer, predicate, matches, elementsOnly, rootNativeNode);
|
|
27164
27253
|
}
|
|
27165
27254
|
else if (tNode.type & 16 /* Projection */) {
|
|
27166
27255
|
// Case 3: the TNode is a projection insertion point (i.e. a <ng-content>).
|
|
@@ -27170,18 +27259,18 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
|
|
|
27170
27259
|
const head = componentHost.projection[tNode.projection];
|
|
27171
27260
|
if (Array.isArray(head)) {
|
|
27172
27261
|
for (let nativeNode of head) {
|
|
27173
|
-
|
|
27262
|
+
_addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
|
|
27174
27263
|
}
|
|
27175
27264
|
}
|
|
27176
27265
|
else if (head) {
|
|
27177
27266
|
const nextLView = componentView[PARENT];
|
|
27178
27267
|
const nextTNode = nextLView[TVIEW].data[head.index];
|
|
27179
|
-
|
|
27268
|
+
_queryNodeChildren(nextTNode, nextLView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27180
27269
|
}
|
|
27181
27270
|
}
|
|
27182
27271
|
else if (tNode.child) {
|
|
27183
27272
|
// Case 4: the TNode is a view.
|
|
27184
|
-
|
|
27273
|
+
_queryNodeChildren(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27185
27274
|
}
|
|
27186
27275
|
// We don't want to go to the next sibling of the root node.
|
|
27187
27276
|
if (rootNativeNode !== nativeNode) {
|
|
@@ -27189,7 +27278,7 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
|
|
|
27189
27278
|
// link, depending on whether the current node has been projected.
|
|
27190
27279
|
const nextTNode = (tNode.flags & 4 /* isProjected */) ? tNode.projectionNext : tNode.next;
|
|
27191
27280
|
if (nextTNode) {
|
|
27192
|
-
|
|
27281
|
+
_queryNodeChildren(nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27193
27282
|
}
|
|
27194
27283
|
}
|
|
27195
27284
|
}
|
|
@@ -27202,12 +27291,12 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
|
|
|
27202
27291
|
* @param elementsOnly whether only elements should be searched
|
|
27203
27292
|
* @param rootNativeNode the root native node on which predicate should not be matched
|
|
27204
27293
|
*/
|
|
27205
|
-
function
|
|
27294
|
+
function _queryNodeChildrenInContainer(lContainer, predicate, matches, elementsOnly, rootNativeNode) {
|
|
27206
27295
|
for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
|
27207
27296
|
const childView = lContainer[i];
|
|
27208
27297
|
const firstChild = childView[TVIEW].firstChild;
|
|
27209
27298
|
if (firstChild) {
|
|
27210
|
-
|
|
27299
|
+
_queryNodeChildren(firstChild, childView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27211
27300
|
}
|
|
27212
27301
|
}
|
|
27213
27302
|
}
|
|
@@ -27220,7 +27309,7 @@ function _queryNodeChildrenInContainerR3(lContainer, predicate, matches, element
|
|
|
27220
27309
|
* @param elementsOnly whether only elements should be searched
|
|
27221
27310
|
* @param rootNativeNode the root native node on which predicate should not be matched
|
|
27222
27311
|
*/
|
|
27223
|
-
function
|
|
27312
|
+
function _addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode) {
|
|
27224
27313
|
if (rootNativeNode !== nativeNode) {
|
|
27225
27314
|
const debugNode = getDebugNode(nativeNode);
|
|
27226
27315
|
if (!debugNode) {
|
|
@@ -27229,7 +27318,7 @@ function _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNati
|
|
|
27229
27318
|
// Type of the "predicate and "matches" array are set based on the value of
|
|
27230
27319
|
// the "elementsOnly" parameter. TypeScript is not able to properly infer these
|
|
27231
27320
|
// types with generics, so we manually cast the parameters accordingly.
|
|
27232
|
-
if (elementsOnly && debugNode instanceof
|
|
27321
|
+
if (elementsOnly && (debugNode instanceof DebugElement) && predicate(debugNode) &&
|
|
27233
27322
|
matches.indexOf(debugNode) === -1) {
|
|
27234
27323
|
matches.push(debugNode);
|
|
27235
27324
|
}
|
|
@@ -27254,7 +27343,7 @@ function _queryNativeNodeDescendants(parentNode, predicate, matches, elementsOnl
|
|
|
27254
27343
|
const node = nodes[i];
|
|
27255
27344
|
const debugNode = getDebugNode(node);
|
|
27256
27345
|
if (debugNode) {
|
|
27257
|
-
if (elementsOnly && debugNode instanceof
|
|
27346
|
+
if (elementsOnly && (debugNode instanceof DebugElement) && predicate(debugNode) &&
|
|
27258
27347
|
matches.indexOf(debugNode) === -1) {
|
|
27259
27348
|
matches.push(debugNode);
|
|
27260
27349
|
}
|
|
@@ -27295,25 +27384,24 @@ function collectPropertyBindings(properties, tNode, lView, tData) {
|
|
|
27295
27384
|
// Need to keep the nodes in a global Map so that multiple angular apps are supported.
|
|
27296
27385
|
const _nativeNodeToDebugNode = new Map();
|
|
27297
27386
|
const NG_DEBUG_PROPERTY = '__ng_debug__';
|
|
27298
|
-
|
|
27387
|
+
/**
|
|
27388
|
+
* @publicApi
|
|
27389
|
+
*/
|
|
27390
|
+
function getDebugNode(nativeNode) {
|
|
27299
27391
|
if (nativeNode instanceof Node) {
|
|
27300
27392
|
if (!(nativeNode.hasOwnProperty(NG_DEBUG_PROPERTY))) {
|
|
27301
27393
|
nativeNode[NG_DEBUG_PROPERTY] = nativeNode.nodeType == Node.ELEMENT_NODE ?
|
|
27302
|
-
new
|
|
27303
|
-
new
|
|
27394
|
+
new DebugElement(nativeNode) :
|
|
27395
|
+
new DebugNode(nativeNode);
|
|
27304
27396
|
}
|
|
27305
27397
|
return nativeNode[NG_DEBUG_PROPERTY];
|
|
27306
27398
|
}
|
|
27307
27399
|
return null;
|
|
27308
27400
|
}
|
|
27309
|
-
|
|
27310
|
-
|
|
27311
|
-
*/
|
|
27312
|
-
const getDebugNode = getDebugNode__POST_R3__;
|
|
27313
|
-
function getDebugNodeR2__POST_R3__(_nativeNode) {
|
|
27401
|
+
// TODO: cleanup all references to this function and remove it.
|
|
27402
|
+
function getDebugNodeR2(_nativeNode) {
|
|
27314
27403
|
return null;
|
|
27315
27404
|
}
|
|
27316
|
-
const getDebugNodeR2 = getDebugNodeR2__POST_R3__;
|
|
27317
27405
|
function getAllDebugNodes() {
|
|
27318
27406
|
return Array.from(_nativeNodeToDebugNode.values());
|
|
27319
27407
|
}
|
|
@@ -27323,14 +27411,6 @@ function indexDebugNode(node) {
|
|
|
27323
27411
|
function removeDebugNodeFromIndex(node) {
|
|
27324
27412
|
_nativeNodeToDebugNode.delete(node.nativeNode);
|
|
27325
27413
|
}
|
|
27326
|
-
/**
|
|
27327
|
-
* @publicApi
|
|
27328
|
-
*/
|
|
27329
|
-
const DebugNode = DebugNode__POST_R3__;
|
|
27330
|
-
/**
|
|
27331
|
-
* @publicApi
|
|
27332
|
-
*/
|
|
27333
|
-
const DebugElement = DebugElement__POST_R3__;
|
|
27334
27414
|
|
|
27335
27415
|
/**
|
|
27336
27416
|
* @license
|