glendix/js/dom

Provides typed DOM element operations at the JavaScript FFI boundary.

Types

Represents a DOM element handle.

pub type DomElement

Represents a DOM rectangle returned by getBoundingClientRect.

pub type DomRect

Values

pub fn blur(element element: DomElement) -> Nil

Removes focus from a DOM element.

pub fn click(element element: DomElement) -> Nil

Dispatches the element’s native click behavior.

pub fn focus(element element: DomElement) -> Nil

Focuses a DOM element.

pub fn get_bounding_client_rect(
  element element: DomElement,
) -> DomRect

Reads the element’s bounding client rectangle.

pub fn query_selector(
  in element: DomElement,
  matching selector: String,
) -> option.Option(DomElement)

Finds the first descendant matching a CSS selector.

pub fn scroll_into_view(element element: DomElement) -> Nil

Scrolls an element into the viewport.

Search Document