Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Utils

Index

Methods

closest

  • closest(element: HTMLElement, selector: string, context?: HTMLElement): null | HTMLElement
  • 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

css

  • css(element: HTMLElement): CSSStyleDeclaration
  • css<K>(element: HTMLElement, prop: K): CSSStyleDeclaration[K]
  • css<K>(element: HTMLElement, prop: K, value: CSSStyleDeclaration[K]): void
  • Get the values of all the CSS properties.

    Parameters

    • element: HTMLElement

      an HTMLElement.

    Returns CSSStyleDeclaration

  • Get the value of style properties.

    Type parameters

    • K: number | keyof CSSStyleDeclaration

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • prop: K

      a property key.

    Returns CSSStyleDeclaration[K]

  • Set one CSS property.

    Type parameters

    • K: number | keyof CSSStyleDeclaration

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • prop: K

      a property key.

    • value: CSSStyleDeclaration[K]

      a property value.

    Returns void

find

  • find(context: HTMLElement, tagName: string, iterator?: (value: HTMLElement, index: number) => void): NodeListOf<HTMLElement>
  • Get elements by tag name.

    Parameters

    • context: HTMLElement

      an HTMLElement.

    • tagName: string

      A tag name.

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

      An iterator.

        • (value: HTMLElement, index: number): void
        • Parameters

          • value: HTMLElement
          • index: number

          Returns void

    Returns NodeListOf<HTMLElement>

is

  • is(element: HTMLElement, selector: string): boolean
  • Check the current matched set of elements against a selector.

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • selector: string

      an element selector.

    Returns boolean

off

  • off(element: HTMLElement, event: string, fn: EventListenerOrEventListenerObject): void
  • Remove an event handler function

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • event: string

      an Event context.

    • fn: EventListenerOrEventListenerObject

      a callback.

    Returns void

on

  • on(element: HTMLElement, event: string, fn: EventListenerOrEventListenerObject): void
  • Attach an event handler function

    Parameters

    • element: HTMLElement

      an HTMLElement.

    • event: string

      an Event context.

    • fn: EventListenerOrEventListenerObject

    Returns void

toggleClass

  • toggleClass(element: HTMLElement, name: string, state: boolean): 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