/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/aria/private/utils/element-resolver.ts
28 строк
863 B
Cheng-Hsuan Tsai
refactor(aria/grid): support deferred focus target (#33072)
24 апр 2026, 19:46
Не верифицирован
24 апр 2026, 19:46
a7b2c51
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {ElementRef} from '@angular/core'; /** A type that allows lazy resolution of a DOM Element. */ export type ElementResolver<T = HTMLElement> = | ElementRef<T> | T | undefined | null | ((context: HTMLElement) => T | null | undefined); /** Evaluates an ElementResolver to return the underlying DOM element, or undefined. */ export function resolveElement<T = HTMLElement>( resolver: ElementResolver<T>, context: HTMLElement, ): T | undefined { if (typeof resolver === 'function') { return (resolver as Function)(context) ?? undefined; } return (resolver instanceof ElementRef ? resolver.nativeElement : resolver) ?? undefined; }