/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
devtools/projects/ng-devtools-backend/src/lib/directive-forest/component-tree/get-roots.ts
27 строк
670 B
hawkgs
refactor(devtools): reorganize backend code
20 июл 2026, 12:15
20 июл 2026, 12:15
a7ebf1c
Код
Авторство
О чём код?
/** * @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 */ /** Returns all app roots. */ export function getAppRoots(): Element[] { const roots = Array.from(document.documentElement.querySelectorAll('[ng-version]')); const isTopLevel = (element: Element) => { let parent: Element | null = element; while (parent?.parentElement) { parent = parent.parentElement; if (parent.hasAttribute('ng-version')) { return false; } } return true; }; return roots.filter(isTopLevel); }