( tView: TView, tNode: TElementNode | TContainerNode | TElementContainerNode, )
| 497 | * If a component is matched (at most one), it is returned in first position in the array. |
| 498 | */ |
| 499 | export function findDirectiveDefMatches( |
| 500 | tView: TView, |
| 501 | tNode: TElementNode | TContainerNode | TElementContainerNode, |
| 502 | ): DirectiveDef<unknown>[] | null { |
| 503 | ngDevMode && assertFirstCreatePass(tView); |
| 504 | ngDevMode && assertTNodeType(tNode, TNodeType.AnyRNode | TNodeType.AnyContainer); |
| 505 | |
| 506 | const registry = tView.directiveRegistry; |
| 507 | let matches: DirectiveDef<unknown>[] | null = null; |
| 508 | if (registry) { |
| 509 | for (let i = 0; i < registry.length; i++) { |
| 510 | const def = registry[i] as ComponentDef<any> | DirectiveDef<any>; |
| 511 | if (isNodeMatchingSelectorList(tNode, def.selectors!, /* isProjectionMode */ false)) { |
| 512 | matches ??= []; |
| 513 | |
| 514 | if (isComponentDef(def)) { |
| 515 | if (ngDevMode) { |
| 516 | assertTNodeType( |
| 517 | tNode, |
| 518 | TNodeType.Element, |
| 519 | `"${tNode.value}" tags cannot be used as component hosts. ` + |
| 520 | `Please use a different tag to activate the ${stringify(def.type)} component.`, |
| 521 | ); |
| 522 | |
| 523 | if (matches.length && isComponentDef(matches[0])) { |
| 524 | throwMultipleComponentError(tNode, matches.find(isComponentDef)!.type, def.type); |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | matches.unshift(def); |
| 529 | } else { |
| 530 | matches.push(def); |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | return matches; |
| 537 | } |
| 538 | |
| 539 | export function elementAttributeInternal( |
| 540 | tNode: TNode, |
nothing calls this directly
no test coverage detected