MCPcopy Create free account
hub / github.com/angular/angular / getIdxOfMatchingSelector

Function getIdxOfMatchingSelector

packages/core/src/render3/queries/query.ts:330–340  ·  view source on GitHub ↗

* Iterates over local names for a given node and returns directive index * (or -1 if a local name points to an element). * * @param tNode static data of a node to check * @param selector selector to match * @returns directive index, -1 or null if a selector didn't match any of the local names

(tNode: TNode, selector: string)

Source from the content-addressed store, hash-verified

328 * @returns directive index, -1 or null if a selector didn't match any of the local names
329 */
330function getIdxOfMatchingSelector(tNode: TNode, selector: string): number | null {
331 const localNames = tNode.localNames;
332 if (localNames !== null) {
333 for (let i = 0; i < localNames.length; i += 2) {
334 if (localNames[i] === selector) {
335 return localNames[i + 1] as number;
336 }
337 }
338 }
339 return null;
340}
341
342function createResultByTNodeType(tNode: TNode, currentView: LView): any {
343 if (tNode.type & (TNodeType.AnyRNode | TNodeType.ElementContainer)) {

Callers 1

matchTNodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected