( tView: TView, tNode: TElementNode | TContainerNode | TElementContainerNode, )
| 457 | * If a component is matched (at most one), it is returned in first position in the array. |
| 458 | */ |
| 459 | export function findDirectiveDefMatches( |
| 460 | tView: TView, |
| 461 | tNode: TElementNode | TContainerNode | TElementContainerNode, |
| 462 | ): DirectiveDef<unknown>[] | null { |
| 463 | ngDevMode && assertFirstCreatePass(tView); |
| 464 | ngDevMode && assertTNodeType(tNode, TNodeType.AnyRNode | TNodeType.AnyContainer); |
| 465 | |
| 466 | const registry = tView.directiveRegistry; |
| 467 | let matches: DirectiveDef<unknown>[] | null = null; |
| 468 | if (registry) { |
| 469 | for (let i = 0; i < registry.length; i++) { |
| 470 | const def = registry[i] as ComponentDef<any> | DirectiveDef<any>; |
| 471 | if (isNodeMatchingSelectorList(tNode, def.selectors!, /* isProjectionMode */ false)) { |
| 472 | matches ??= []; |
| 473 | |
| 474 | if (isComponentDef(def)) { |
| 475 | if (ngDevMode) { |
| 476 | assertTNodeType( |
| 477 | tNode, |
| 478 | TNodeType.Element, |
| 479 | `"${tNode.value}" tags cannot be used as component hosts. ` + |
| 480 | `Please use a different tag to activate the ${stringify(def.type)} component.`, |
| 481 | ); |
| 482 | |
| 483 | if (matches.length && isComponentDef(matches[0])) { |
| 484 | throwMultipleComponentError(tNode, matches.find(isComponentDef)!.type, def.type); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | matches.unshift(def); |
| 489 | } else { |
| 490 | matches.push(def); |
| 491 | } |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | return matches; |
| 497 | } |
| 498 | |
| 499 | export function elementAttributeInternal( |
| 500 | tNode: TNode, |
nothing calls this directly
no test coverage detected
searching dependent graphs…