DOMUtils: {
    addClass(element, className): void;
    getComputedStyle(element, property): string;
    getElementDimensions(element): {
        width: number;
        height: number;
    };
    getElementOffset(element): {
        top: number;
        left: number;
    };
    getScrollPosition(element): {
        scrollTop: number;
        scrollLeft: number;
    };
    hasClass(element, className): boolean;
    isElementInViewport(element): boolean;
    isElementPartiallyVisible(element): boolean;
    removeClass(element, className): void;
    scrollIntoView(element, options?): void;
    setScrollPosition(element, position): void;
    setStyle(element, property, value): void;
    toggleClass(element, className, force?): void;
    waitForElement(selector, timeout?): Promise<null | Element>;
} = ...

Type declaration

  • addClass:function
    • Adds a class to an element if it doesn't already have it.

      Parameters

      • element: null | Element

        The DOM element to modify

      • className: string

        The class name to add

      Returns void

      Throws

      If element is not a valid DOM element

  • getComputedStyle:function
    • Gets the computed style of an element.

      Parameters

      • element: null | Element

        The DOM element to check

      • property: string

        The CSS property to get (e.g., 'width', 'color')

      Returns string

      The computed value of the property or empty string if element is null

  • getElementDimensions:function
    • Gets the dimensions of an element including margins.

      Parameters

      • element: null | Element

        The DOM element to measure

      Returns {
          width: number;
          height: number;
      }

      Object containing width and height, or {width: 0, height: 0} if element is null

      • width: number
      • height: number
  • getElementOffset:function
    • Gets the offset position of an element relative to the document.

      Parameters

      • element: null | Element

        The DOM element to measure

      Returns {
          top: number;
          left: number;
      }

      Object containing top and left offsets, or {top: 0, left: 0} if element is null

      • top: number
      • left: number
  • getScrollPosition:function
    • Gets the scroll position of an element.

      Parameters

      • element: null | Element

        The DOM element to check

      Returns {
          scrollTop: number;
          scrollLeft: number;
      }

      Object containing scrollTop and scrollLeft values, or {scrollTop: 0, scrollLeft: 0} if element is null

      • scrollTop: number
      • scrollLeft: number
  • hasClass:function
    • Checks if an element has a specific class.

      Parameters

      • element: null | Element

        The DOM element to check

      • className: string

        The class name to check for

      Returns boolean

      True if the element has the class, false otherwise

  • isElementInViewport:function
    • Checks if an element is currently fully visible in the viewport.

      Parameters

      • element: null | Element

        The DOM element to check

      Returns boolean

      True if the element is fully visible in the viewport, false otherwise

  • isElementPartiallyVisible:function
    • Checks if an element is partially visible in the viewport.

      Parameters

      • element: null | Element

        The DOM element to check

      Returns boolean

      True if any part of the element is visible in the viewport, false otherwise

  • removeClass:function
    • Removes a class from an element if it has it.

      Parameters

      • element: null | Element

        The DOM element to modify

      • className: string

        The class name to remove

      Returns void

  • scrollIntoView:function
    • Scrolls an element into view with smooth behavior.

      Parameters

      • element: null | Element

        The DOM element to scroll into view

      • options: ScrollIntoViewOptions = ...

        ScrollIntoViewOptions for customizing scroll behavior

      Returns void

  • setScrollPosition:function
    • Sets the scroll position of an element.

      Parameters

      • element: null | Element

        The DOM element to modify

      • position: {
            scrollTop: number;
            scrollLeft: number;
        }

        Object containing scrollTop and scrollLeft values

        • scrollTop: number
        • scrollLeft: number

      Returns void

  • setStyle:function
    • Sets a CSS property on an element.

      Parameters

      • element: null | Element

        The DOM element to modify

      • property: string

        The CSS property to set (e.g., 'width', 'color')

      • value: string

        The value to set

      Returns void

  • toggleClass:function
    • Toggles a class on an element.

      Parameters

      • element: null | Element

        The DOM element to modify

      • className: string

        The class name to toggle

      • Optional force: boolean

        Optional boolean to force add or remove the class

      Returns void

  • waitForElement:function
    • Waits for an element to be present in the DOM.

      Parameters

      • selector: string

        CSS selector for the element

      • timeout: number = 5000

        Maximum time to wait in milliseconds (default: 5000)

      Returns Promise<null | Element>

      Promise that resolves with the element or null if not found within timeout