Skip to content

The open alternative to Salesforce, designed for AI.

376 B
Raw Blame
import { collectAncestorChainFromRootToNode } from '@/polyfills/dom/utils/collectAncestorChainFromRootToNode';
import { type SelectorElementLike } from '@/polyfills/selectors/types/SelectorElementLike';

export const resolveNodeTreeRoot = (
  node: SelectorElementLike,
): SelectorElementLike =>
  (collectAncestorChainFromRootToNode(node)[0] ?? node) as SelectorElementLike;