UNPKG

@base-ui-components/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

10 lines 382 B
import { getParentNode, isHTMLElement, isLastTraversableNode } from '@floating-ui/utils/dom'; export function findRootOwnerId(node) { if (isHTMLElement(node) && node.hasAttribute('data-rootownerid')) { return node.getAttribute('data-rootownerid') ?? undefined; } if (isLastTraversableNode(node)) { return undefined; } return findRootOwnerId(getParentNode(node)); }