plinth/browser/element

Types

pub type Element
pub type Position {
  BeforeBegin
  AfterBegin
  BeforeEnd
  AfterEnd
}

Constructors

  • BeforeBegin
  • AfterBegin
  • BeforeEnd
  • AfterEnd

Functions

pub fn add_event_listener(
  a: Element,
  b: String,
  c: fn(Event(a)) -> Nil,
) -> fn() -> Nil
pub fn append_child(parent: Element, child: Element) -> Nil
pub fn cast(raw: Dynamic) -> Result(Element, DecodeError)
pub fn closest(
  element: Element,
  selector: String,
) -> Result(Element, Nil)
pub fn dataset_get(
  element: Element,
  key: String,
) -> Result(String, Nil)
pub fn focus(element: Element) -> Nil
pub fn get_attribute(
  element: Element,
  name: String,
) -> Result(String, Nil)
pub fn get_checked(element: Element) -> Bool
pub fn inner_text(element: Element) -> String
pub fn insert_adjacent_element(
  target: Element,
  position: Position,
  element: Element,
) -> Result(Element, String)
pub fn insert_adjacent_html(
  target: Element,
  position: Position,
  html: String,
) -> Result(Element, String)
pub fn insert_adjacent_text(
  target: Element,
  position: Position,
  text: String,
) -> Result(Element, String)
pub fn next_element_sibling(
  element: Element,
) -> Result(Element, Nil)
pub fn remove(a: Element) -> Nil
pub fn request_fullscreen(
  element: Element,
) -> Promise(Result(Nil, String))
pub fn scroll_height(element: Element) -> Float
pub fn scroll_into_view(element: Element) -> Nil
pub fn scroll_left(element: Element) -> Float
pub fn scroll_top(element: Element) -> Float
pub fn scroll_width(element: Element) -> Float
pub fn selection_start(element: Element) -> Result(Int, Nil)
pub fn set_attribute(
  element: Element,
  name: String,
  value: String,
) -> Nil
pub fn set_inner_html(element: Element, value: String) -> Nil
pub fn set_inner_text(element: Element, value: String) -> Nil
pub fn set_scroll_height(element: Element, value: Float) -> Nil
pub fn set_scroll_left(element: Element, value: Float) -> Nil
pub fn set_scroll_top(element: Element, value: Float) -> Nil
pub fn set_scroll_width(element: Element, value: Float) -> Nil
pub fn set_selection_range(
  element: Element,
  start: Int,
  end: Int,
) -> Nil
pub fn set_text_content(element: Element, text: String) -> Nil
pub fn set_value(element: Element, value: String) -> Nil
pub fn value(element: Element) -> Result(String, Nil)
Search Document