Skip to content

⬅️ Back to Table of Contents

📄 _resolve-element

📊 Analysis Summary

Metric Count
🔧 Functions 1

📚 Table of Contents

🛠️ File Location:

📂 packages/core/_resolve-element.ts

Functions

resolveElement(el: HTMLElement | SVGElement | Window | Doc…): HTMLElement | SVGElement | null | undefined

Resolves an element from a given element, window, or document.

Tags: @internal

Raw JSDoc
/**
 * Resolves an element from a given element, window, or document.
 *
 * @internal
 */
Code
export function resolveElement(
  el: HTMLElement | SVGElement | Window | Document | null | undefined,
): HTMLElement | SVGElement | null | undefined {
  if (typeof Window !== 'undefined' && el instanceof Window)
    return el.document.documentElement

  if (typeof Document !== 'undefined' && el instanceof Document)
    return el.documentElement

  return el as HTMLElement | SVGElement | null | undefined
}

Generated by Syntax Scribe