Sign in

    dom_api

    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    last year
    Downloads
    29

    #dom_api

    #Supported DOM APIs

    #Document

    • get_element_by_id
    • get_elements_by_tag_name
    • get_elements_by_class_name
    • query_selector
    • query_selector_all
    • create_element
    • create_text_node
    • get_body
    • get_head

    #Element

    • get_attribute
    • set_attribute
    • remove_attribute
    • has_attribute
    • get_tag_name
    • get_id / set_id
    • get_class_name / set_class_name
    • add_class / remove_class / toggle_class / contains_class
    • get_inner_html / set_inner_html
    • get_text_content / set_text_content
    • query_selector / query_selector_all
    • add_event_listener / remove_event_listener / dispatch_event

    #Node

    • append_child
    • insert_before
    • remove_child
    • replace_child
    • clone_node
    • get_parent_node
    • get_first_child
    • get_last_child
    • get_next_sibling
    • get_previous_sibling
    • get_child_nodes

    #HTMLElement

    • click
    • focus
    • blur
    • get_style
    • get_offset_width / get_offset_height
    • get_client_width / get_client_height
    • get_scroll_width / get_scroll_height
    • get_scroll_top / set_scroll_top
    • get_scroll_left / set_scroll_left

    #Event

    • prevent_default
    • stop_propagation
    • stop_immediate_propagation
    • get_type
    • get_target
    • get_current_target

    #NodeList

    • length
    • item
    • get
    • for_each
    • to_array

    #CSSStyleDeclaration

    • get_property_value
    • set_property
    • remove_property
    • set_display
    • set_color
    • set_background_color
    • set_width
    • set_height

    #Global Functions

    • document()
    • window
    • create_element
    • get_element_by_id
    • query_selector
    • query_selector_all

    IsElement

    pub trait IsElement {
    }
    DOM Element trait

    IsEvent

    pub trait IsEvent {
    }
    DOM Event trait

    IsNode

    pub trait IsNode {
    }
    DOM Node trait

    CSSStyleDeclaration

    pub type CSSStyleDeclaration

    CSSStyleDeclaration::get_property_value

    fn CSSStyleDeclaration::get_property_value(self : CSSStyleDeclaration, property : String) -> String

    CSSStyleDeclaration::remove_property

    fn CSSStyleDeclaration::remove_property(self : CSSStyleDeclaration, property : String) -> String

    CSSStyleDeclaration::set_background_color

    fn CSSStyleDeclaration::set_background_color(self : CSSStyleDeclaration, value : String) -> Unit

    CSSStyleDeclaration::set_color

    fn CSSStyleDeclaration::set_color(self : CSSStyleDeclaration, value : String) -> Unit

    CSSStyleDeclaration::set_display

    fn CSSStyleDeclaration::set_display(self : CSSStyleDeclaration, value : String) -> Unit

    CSSStyleDeclaration::set_height

    fn CSSStyleDeclaration::set_height(self : CSSStyleDeclaration, value : String) -> Unit

    CSSStyleDeclaration::set_property

    fn CSSStyleDeclaration::set_property(self : CSSStyleDeclaration, property : String, value : String, priority? :
    Optional
    [String]) -> Unit

    CSSStyleDeclaration::set_width

    fn CSSStyleDeclaration::set_width(self : CSSStyleDeclaration, value : String) -> Unit

    Document

    pub type Document
    DOM core interfaces and utility functions

    Document::create_element

    fn Document::create_element(self : Document, tagName : String) -> Element
    Create element

    Document::create_text_node

    fn Document::create_text_node(self : Document, text : String) -> Node
    Create text node

    Document::get_body

    fn Document::get_body(self : Document) -> HTMLElement?
    Get body/head

    Document::get_element_by_id

    fn Document::get_element_by_id(self : Document, id : String) -> Element?
    Get element by id

    Document::get_elements_by_class_name

    fn Document::get_elements_by_class_name(self : Document, className : String) -> NodeList
    Get elements by class name

    Document::get_elements_by_tag_name

    fn Document::get_elements_by_tag_name(self : Document, tagName : String) -> NodeList
    Get elements by tag name

    Document::get_head

    fn Document::get_head(self : Document) -> HTMLElement?

    Document::query_selector

    fn Document::query_selector(self : Document, selector : String) -> Element?
    Query selector

    Document::query_selector_all

    fn Document::query_selector_all(self : Document, selector : String) -> NodeList
    Query selector all

    Element

    pub type Element

    Element::add_class

    fn Element::add_class(self : Element, className : String) -> Unit

    Element::add_event_listener

    fn Element::add_event_listener(self : Element, event_type : String, listener : (Event) -> Unit, options? :
    Optional
    [Bool]) -> Unit

    Element::contains_class

    fn Element::contains_class(self : Element, className : String) -> Bool

    Element::dispatch_event

    fn Element::dispatch_event(self : Element, event : Event) -> Bool

    Element::get_attribute

    fn Element::get_attribute(self : Element, name : String) -> String?

    Element::get_class_name

    fn Element::get_class_name(self : Element) -> String

    Element::get_id

    fn Element::get_id(self : Element) -> String

    Element::get_inner_html

    fn Element::get_inner_html(self : Element) -> String

    Element::get_tag_name

    fn Element::get_tag_name(self : Element) -> String

    Element::get_text_content

    fn Element::get_text_content(self : Element) -> String

    Element::has_attribute

    fn Element::has_attribute(self : Element, name : String) -> Bool

    Element::query_selector

    fn Element::query_selector(self : Element, selector : String) -> Element?

    Element::query_selector_all

    fn Element::query_selector_all(self : Element, selector : String) -> NodeList

    Element::remove_attribute

    fn Element::remove_attribute(self : Element, name : String) -> Unit

    Element::remove_class

    fn Element::remove_class(self : Element, className : String) -> Unit

    Element::remove_event_listener

    fn Element::remove_event_listener(self : Element, event_type : String, listener : (Event) -> Unit, options? :
    Optional
    [Bool]) -> Unit

    Element::set_attribute

    fn Element::set_attribute(self : Element, name : String, value : String) -> Unit

    Element::set_class_name

    fn Element::set_class_name(self : Element, className : String) -> Unit

    Element::set_id

    fn Element::set_id(self : Element, id : String) -> Unit

    Element::set_inner_html

    fn Element::set_inner_html(self : Element, html : String) -> Unit

    Element::set_text_content

    fn Element::set_text_content(self : Element, text : String) -> Unit

    Element::toggle_class

    fn Element::toggle_class(self : Element, className : String) -> Bool

    Event

    pub type Event

    Event::get_current_target

    fn Event::get_current_target(self : Event) -> Element?

    Event::get_target

    fn Event::get_target(self : Event) -> Element?

    Event::get_type

    fn Event::get_type(self : Event) -> String

    Event::prevent_default

    fn Event::prevent_default(self : Event) -> Unit

    Event::stop_immediate_propagation

    fn Event::stop_immediate_propagation(self : Event) -> Unit

    Event::stop_propagation

    fn Event::stop_propagation(self : Event) -> Unit

    HTMLCollection

    pub type HTMLCollection

    HTMLElement

    pub type HTMLElement

    HTMLElement::blur

    fn HTMLElement::blur(self : HTMLElement) -> Unit

    HTMLElement::click

    fn HTMLElement::click(self : HTMLElement) -> Unit

    HTMLElement::focus

    fn HTMLElement::focus(self : HTMLElement) -> Unit

    HTMLElement::get_client_height

    fn HTMLElement::get_client_height(self : HTMLElement) -> Double

    HTMLElement::get_client_width

    fn HTMLElement::get_client_width(self : HTMLElement) -> Double

    HTMLElement::get_offset_height

    fn HTMLElement::get_offset_height(self : HTMLElement) -> Double

    HTMLElement::get_offset_width

    fn HTMLElement::get_offset_width(self : HTMLElement) -> Double

    HTMLElement::get_scroll_height

    fn HTMLElement::get_scroll_height(self : HTMLElement) -> Double

    HTMLElement::get_scroll_left

    fn HTMLElement::get_scroll_left(self : HTMLElement) -> Double

    HTMLElement::get_scroll_top

    fn HTMLElement::get_scroll_top(self : HTMLElement) -> Double

    HTMLElement::get_scroll_width

    fn HTMLElement::get_scroll_width(self : HTMLElement) -> Double

    HTMLElement::get_style

    HTMLElement::set_scroll_left

    fn HTMLElement::set_scroll_left(self : HTMLElement, value : Double) -> Unit

    HTMLElement::set_scroll_top

    fn HTMLElement::set_scroll_top(self : HTMLElement, value : Double) -> Unit

    Node

    pub type Node

    Node::append_child

    fn Node::append_child(self : Node, child : Node) -> Node

    Node::clone_node

    fn Node::clone_node(self : Node, deep : Bool) -> Node

    Node::get_child_nodes

    fn Node::get_child_nodes(self : Node) -> NodeList

    Node::get_first_child

    fn Node::get_first_child(self : Node) -> Node?

    Node::get_last_child

    fn Node::get_last_child(self : Node) -> Node?

    Node::get_next_sibling

    fn Node::get_next_sibling(self : Node) -> Node?

    Node::get_parent_node

    fn Node::get_parent_node(self : Node) -> Node?

    Node::get_previous_sibling

    fn Node::get_previous_sibling(self : Node) -> Node?

    Node::insert_before

    fn Node::insert_before(self : Node, newNode : Node, referenceNode : Node?) -> Node

    Node::remove_child

    fn Node::remove_child(self : Node, child : Node) -> Node

    Node::replace_child

    fn Node::replace_child(self : Node, newChild : Node, oldChild : Node) -> Node

    NodeList

    pub type NodeList

    NodeList::for_each

    fn NodeList::for_each(self : NodeList, f : (Node) -> Unit) -> Unit

    NodeList::get

    fn NodeList::get(self : NodeList, index : Int) -> Node?

    NodeList::item

    fn NodeList::item(self : NodeList, index : Int) -> Node?

    NodeList::length

    fn NodeList::length(self : NodeList) -> Int

    NodeList::to_array

    fn NodeList::to_array(self : NodeList) -> Array[Node]

    create_element

    fn create_element(tagName : String) -> Element
    Create element (global)

    document

    fn document() -> Document
    Get the global document object

    get_element_by_id

    fn get_element_by_id(id : String) -> Element?
    Get element by id (global)

    query_selector

    fn query_selector(selector : String) -> Element?
    Global query_selector

    query_selector_all

    fn query_selector_all(selector : String) -> NodeList
    Global query_selector_all

    window

    Get the global window object

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io