interface Utils {
    closest(element, selector, context?): null | HTMLElement;
    css(element): CSSStyleDeclaration;
    css<K>(element, prop): CSSStyleDeclaration[K];
    css<K>(element, prop, value): void;
    find(context, tagName, iterator?): NodeListOf<HTMLElement>;
    is(element, selector): boolean;
    off(element, event, fn): void;
    on(element, event, fn): void;
    toggleClass(element, name, state): void;
}

Methods

  • For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • selector: string

      an element seletor.

    • Optional context: HTMLElement

      a specific element's context.

    Returns null | HTMLElement

  • Get the values of all the CSS properties.

    Parameters

    • element: HTMLElement

      an HTMLElement.

    Returns CSSStyleDeclaration

  • Get the value of style properties.

    Type Parameters

    • K extends keyof CSSStyleDeclaration

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • prop: K

      a property key.

    Returns CSSStyleDeclaration[K]

  • Set one CSS property.

    Type Parameters

    • K extends keyof CSSStyleDeclaration

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • prop: K

      a property key.

    • value: CSSStyleDeclaration[K]

      a property value.

    Returns void

  • Get elements by tag name.

    Parameters

    • context: HTMLElement

      an HTMLElement.

    • tagName: string

      A tag name.

    • Optional iterator: ((value, index) => void)

      An iterator.

        • (value, index): void
        • Parameters

          • value: HTMLElement
          • index: number

          Returns void

    Returns NodeListOf<HTMLElement>

  • Check the current matched set of elements against a selector.

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • selector: string

      an element selector.

    Returns boolean

  • Remove an event handler function

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • event: string

      an Event context.

    • fn: EventListenerOrEventListenerObject

      a callback.

    Returns void

  • Attach an event handler function

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • event: string

      an Event context.

    • fn: EventListenerOrEventListenerObject

    Returns void

  • Add or remove one classes from each element

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • name: string

      a class name.

    • state: boolean

      a class's state.

    Returns void

Generated using TypeDoc