/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/cdk/drag-drop/dom/root-node.ts
25 строк
771 B
Naji
docs: replace angular.io links with angular.dev (#29734)
19 сен 2024, 13:57
Не верифицирован
19 сен 2024, 13:57
5782834
Код
Авторство
О чём код?
/** * @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 {EmbeddedViewRef} from '@angular/core'; /** * Gets the root HTML element of an embedded view. * If the root is not an HTML element it gets wrapped in one. */ export function getRootNode(viewRef: EmbeddedViewRef<any>, _document: Document): HTMLElement { const rootNodes: Node[] = viewRef.rootNodes; if (rootNodes.length === 1 && rootNodes[0].nodeType === _document.ELEMENT_NODE) { return rootNodes[0] as HTMLElement; } const wrapper = _document.createElement('div'); rootNodes.forEach(node => wrapper.appendChild(node)); return wrapper; }