Sign in

    This version of the module is deprecated: Use moonbit-community/rabbita instead.

    #DOM API

    This package provides incomplete API bindings for the DOM in the JavaScript backend.

    Since the codegen tool for js binding is not yet available, the API is manually written. Rather than providing an elegant and convenient API, this package offers a low-level API that faithfully mirrors the underlying JavaScript DOM API while maintaining null-safety.

    Warning: This package is not intended for the average Rabbit-TEA user. Using this API may result in losing cross-platform compatibility in the future.

    #Naming Conventions and file structure

    • All types and their associated methods are defined in corresponding files using snake_case naming style.
    • For Types, use CamelCase naming.
    • For methods, use snake_case naming.
      • If a method has multiple overloads, additional suffixes are appended to the method name based on the characteristics of the parameter list to avoid naming conflicts.
      • Do not define methods inherited from the parent type.
    • For properties, they are encapsulated as methods with set_ and get_ prefixes.
    • Optional parameters are set as labeled arguments and use the @js.Optional[A] type, with the default value set to @js.Optional::undefined().
    • For union types, depending on the number of parameters, use types like @js.Union2[A, B], @js.Union3[A, B, C], etc.
    • For parameters or return values that may be null, use the @js.Nullable[A] type.
    • For type conversions, use the to_ prefix followed by the snake_case style type name:
      • For upcasting, directly return the converted type.
      • For downcasting, return the @js.Nullable[A] type. Use arg instanceof A to check if the conversion is valid; if valid, return the converted type, otherwise return null.
      • Only define the conversion methods for direct parent-child relationships in the inheritance hierarchy.

    #Hierarchy of DOM Types

    The partial inheritance hierarchy of DOM types in JavaScript is as follows:

    Event <-+-- ClipboardEvent +-- UIEvent <--+-- MouseEvent +-- InputEvent +-- FocusEvent +-- KeyboardEvent EventTarget <---+--Clipboard +--Node <--+-- Document +-- DocumentFragment +-- Element <-- HTMLElement <--+-- HTMLCanvasElement +-- HTMLInputElement +-- HTMLDialogElement +-- HTMLImageElement

    #Troubleshooting

    #I can't find the corresponding method

    Since MoonBit does not have an inheritance mechanism, when calling methods, you need to first convert the type to the corresponding type.

    For example, if you want to add an event listener to an instance of HTMLElement, you need to first convert it to the EventTarget type and then call the add_event_listener method.

    #I can't find the corresponding type conversion function

    For maintainability reasons, all type conversions can only occur between parent nodes and direct child nodes in the inheritance tree.

    For example, if you want to convert a Element to a HTMLCanvasElement, you can do so using x.to_html_element().to_html_canvas_element().

    #Contribution

    Contributions to this DOM package are welcome! To ensure a smooth collaboration, please follow these guidelines:

    • Code Style: Adhere to the naming conventions and file structure outlined above.
    • Documentation: Update the README or add inline comments to document any new features or changes.
    • Pull Requests: Include a link to the relevant MDN documentation for the API you implemented. Small, focused pull requests are preferred over large, complex ones.
    • Issue Reporting: If you encounter bugs or have feature requests, please open an issue with detailed information.

    ImageUnion

    https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage

    Listener

    typealias (Event) -> Unit as Listener

    PredefinedColorSpace

    typealias String as PredefinedColorSpace
    Possible values are "srgb" and "display-p3".

    CanvasGradient

    type CanvasGradient

    CanvasGradient::add_color_stop

    fn CanvasGradient::add_color_stop(self : CanvasGradient, offset : Double, color : String) -> Unit

    CanvasLineCap

    type CanvasLineCap

    CanvasLineJoin

    type CanvasLineJoin

    CanvasPattern

    type CanvasPattern

    CanvasPattern::set_transform

    fn CanvasPattern::set_transform(self : CanvasPattern, transform :
    Optional
    [DOMMatrix2DInit]) -> Unit

    CanvasRenderingContext2D

    type CanvasRenderingContext2D

    CanvasRenderingContext2D::arc

    fn CanvasRenderingContext2D::arc(self : CanvasRenderingContext2D, x : Double, y : Double, radius : Double, start_angle : Double, end_angle : Double, anticlockwise~ : Bool = ..) -> Unit

    CanvasRenderingContext2D::arc_to

    fn CanvasRenderingContext2D::arc_to(self : CanvasRenderingContext2D, x1 : Double, y1 : Double, x2 : Double, y2 : Double, radius : Double) -> Unit

    CanvasRenderingContext2D::begin_path

    fn CanvasRenderingContext2D::begin_path(self : CanvasRenderingContext2D) -> Unit

    CanvasRenderingContext2D::bezier_curve_to

    fn CanvasRenderingContext2D::bezier_curve_to(self : CanvasRenderingContext2D, cp1x : Double, cp1y : Double, cp2x : Double, cp2y : Double, x : Double, y : Double) -> Unit

    CanvasRenderingContext2D::clear_rect

    fn CanvasRenderingContext2D::clear_rect(self : CanvasRenderingContext2D, x : Double, y : Double, w : Double, h : Double) -> Unit

    CanvasRenderingContext2D::clip

    fn CanvasRenderingContext2D::clip(self : CanvasRenderingContext2D, fill_rule~ : String = ..) -> Unit

    CanvasRenderingContext2D::clip_with_path

    fn CanvasRenderingContext2D::clip_with_path(self : CanvasRenderingContext2D, path : Path2D, fill_rule~ : String = ..) -> Unit

    CanvasRenderingContext2D::close_path

    fn CanvasRenderingContext2D::close_path(self : CanvasRenderingContext2D) -> Unit

    CanvasRenderingContext2D::create_image_data

    fn CanvasRenderingContext2D::create_image_data(self : CanvasRenderingContext2D, sw : Double, sh : Double, settings~ :
    Optional
    [ImageDataSettings] = ..) -> ImageData

    CanvasRenderingContext2D::create_image_data_with_data

    fn CanvasRenderingContext2D::create_image_data_with_data(self : CanvasRenderingContext2D, data : ImageData) -> ImageData

    CanvasRenderingContext2D::create_linear_gradient

    fn CanvasRenderingContext2D::create_linear_gradient(self : CanvasRenderingContext2D, x0 : Double, y0 : Double, x1 : Double, y1 : Double) -> CanvasGradient

    CanvasRenderingContext2D::create_radial_gradient

    fn CanvasRenderingContext2D::create_radial_gradient(self : CanvasRenderingContext2D, x0 : Double, y0 : Double, r0 : Double, x1 : Double, y1 : Double, r1 : Double) -> CanvasGradient

    CanvasRenderingContext2D::draw_image

    https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage

    CanvasRenderingContext2D::draw_image_with_size

    https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage

    CanvasRenderingContext2D::draw_image_with_src_and_dst_size

    fn CanvasRenderingContext2D::draw_image_with_src_and_dst_size(self : CanvasRenderingContext2D, image :
    Union7
    [HTMLImageElement, SVGImageElement, HTMLVideoElement, HTMLCanvasElement, ImageBitmap, OffscreenCanvas, VideoFrame], sx : Double, sy : Double, sw : Double, sh : Double, dx : Double, dy : Double, dw : Double, dh : Double) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage

    CanvasRenderingContext2D::ellipse

    fn CanvasRenderingContext2D::ellipse(self : CanvasRenderingContext2D, x : Double, y : Double, radius_x : Double, radius_y : Double, rotation : Double, start_angle : Double, end_angle : Double, anticlockwise~ : Bool = ..) -> Unit

    CanvasRenderingContext2D::fill

    fn CanvasRenderingContext2D::fill(self : CanvasRenderingContext2D, fill_rule~ : String = ..) -> Unit

    CanvasRenderingContext2D::fill_path

    fn CanvasRenderingContext2D::fill_path(self : CanvasRenderingContext2D, path : Path2D, fill_rule~ : String = ..) -> Unit

    CanvasRenderingContext2D::fill_rect

    fn CanvasRenderingContext2D::fill_rect(self : CanvasRenderingContext2D, x : Double, y : Double, w : Double, h : Double) -> Unit

    CanvasRenderingContext2D::fill_text

    fn CanvasRenderingContext2D::fill_text(self : CanvasRenderingContext2D, text : String, x : Double, y : Double, max_width~ :
    Optional
    [Double] = ..) -> Unit

    CanvasRenderingContext2D::get_fill_style

    CanvasRenderingContext2D::get_font

    fn CanvasRenderingContext2D::get_font(self : CanvasRenderingContext2D) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font

    CanvasRenderingContext2D::get_image_data

    fn CanvasRenderingContext2D::get_image_data(self : CanvasRenderingContext2D, sx : Double, sy : Double, sw : Double, sh : Double, settings~ :
    Optional
    [ImageDataSettings] = ..) -> ImageData

    CanvasRenderingContext2D::get_image_smoothing_quality

    fn CanvasRenderingContext2D::get_image_smoothing_quality(self : CanvasRenderingContext2D) -> String

    CanvasRenderingContext2D::get_line_cap

    CanvasRenderingContext2D::get_line_join

    CanvasRenderingContext2D::get_line_with

    fn CanvasRenderingContext2D::get_line_with(self : CanvasRenderingContext2D) -> Double

    CanvasRenderingContext2D::get_stroke_style

    CanvasRenderingContext2D::image_smoothing_enabled

    fn CanvasRenderingContext2D::image_smoothing_enabled(self : CanvasRenderingContext2D) -> Bool

    CanvasRenderingContext2D::is_context_lost

    fn CanvasRenderingContext2D::is_context_lost(self : CanvasRenderingContext2D) -> Bool

    CanvasRenderingContext2D::is_point_in_path

    fn CanvasRenderingContext2D::is_point_in_path(self : CanvasRenderingContext2D, x : Double, y : Double, fill_rule~ : String = ..) -> Bool

    CanvasRenderingContext2D::is_point_in_path_with_path

    fn CanvasRenderingContext2D::is_point_in_path_with_path(self : CanvasRenderingContext2D, path : Path2D, x : Double, y : Double, fill_rule~ : String = ..) -> Bool

    CanvasRenderingContext2D::is_point_in_stroke

    fn CanvasRenderingContext2D::is_point_in_stroke(self : CanvasRenderingContext2D, x : Double, y : Double) -> Bool

    CanvasRenderingContext2D::is_point_in_stroke_with_path

    fn CanvasRenderingContext2D::is_point_in_stroke_with_path(self : CanvasRenderingContext2D, path : Path2D, x : Double, y : Double) -> Bool

    CanvasRenderingContext2D::line_to

    fn CanvasRenderingContext2D::line_to(self : CanvasRenderingContext2D, x : Double, y : Double) -> Unit

    CanvasRenderingContext2D::move_to

    fn CanvasRenderingContext2D::move_to(self : CanvasRenderingContext2D, x : Double, y : Double) -> Unit

    CanvasRenderingContext2D::put_image_data

    fn CanvasRenderingContext2D::put_image_data(self : CanvasRenderingContext2D, image_data : ImageData, dx : Int, dy : Int) -> Unit

    CanvasRenderingContext2D::put_image_data_with_dirty

    fn CanvasRenderingContext2D::put_image_data_with_dirty(self : CanvasRenderingContext2D, image_data : ImageData, dx : Int, dy : Int, dirty_x : Int, dirty_y : Int, dirty_width : Int, dirty_height : Int) -> Unit

    CanvasRenderingContext2D::quardratic_curve_to

    fn CanvasRenderingContext2D::quardratic_curve_to(self : CanvasRenderingContext2D, cpx : Double, cpy : Double, x : Double, y : Double) -> Unit

    CanvasRenderingContext2D::rect

    fn CanvasRenderingContext2D::rect(self : CanvasRenderingContext2D, x : Double, y : Double, w : Double, h : Double) -> Unit

    CanvasRenderingContext2D::reset

    CanvasRenderingContext2D::reset_transform

    fn CanvasRenderingContext2D::reset_transform(self : CanvasRenderingContext2D) -> Unit

    CanvasRenderingContext2D::restore

    CanvasRenderingContext2D::rotate

    fn CanvasRenderingContext2D::rotate(self : CanvasRenderingContext2D, angle : Double) -> Unit

    CanvasRenderingContext2D::round_rect

    fn CanvasRenderingContext2D::round_rect(self : CanvasRenderingContext2D, x : Double, y : Double, w : Double, h : Double, radius : Double) -> Unit

    CanvasRenderingContext2D::save

    CanvasRenderingContext2D::scale

    fn CanvasRenderingContext2D::scale(self : CanvasRenderingContext2D, x : Double, y : Double) -> Unit

    CanvasRenderingContext2D::set_fill_style

    CanvasRenderingContext2D::set_font

    fn CanvasRenderingContext2D::set_font(self : CanvasRenderingContext2D, value : String) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font

    CanvasRenderingContext2D::set_image_smoothing_quality

    fn CanvasRenderingContext2D::set_image_smoothing_quality(self : CanvasRenderingContext2D, value : String) -> Unit
    Possible values are "low", "medium", and "high".

    CanvasRenderingContext2D::set_line_cap

    fn CanvasRenderingContext2D::set_line_cap(self : CanvasRenderingContext2D, value : CanvasLineCap) -> Unit

    CanvasRenderingContext2D::set_line_join

    fn CanvasRenderingContext2D::set_line_join(self : CanvasRenderingContext2D, value : CanvasLineJoin) -> Unit

    CanvasRenderingContext2D::set_line_width

    fn CanvasRenderingContext2D::set_line_width(self : CanvasRenderingContext2D, value : Double) -> Unit

    CanvasRenderingContext2D::set_stroke_style

    CanvasRenderingContext2D::set_transform

    fn CanvasRenderingContext2D::set_transform(self : CanvasRenderingContext2D, a : Double, b : Double, c : Double, d : Double, e : Double, f : Double) -> Unit

    CanvasRenderingContext2D::stroke

    CanvasRenderingContext2D::stroke_rect

    fn CanvasRenderingContext2D::stroke_rect(self : CanvasRenderingContext2D, x : Double, y : Double, w : Double, h : Double) -> Unit

    CanvasRenderingContext2D::stroke_text

    fn CanvasRenderingContext2D::stroke_text(self : CanvasRenderingContext2D, text : String, x : Double, y : Double, max_width~ :
    Optional
    [Double] = ..) -> Unit

    CanvasRenderingContext2D::stroke_with_path

    fn CanvasRenderingContext2D::stroke_with_path(self : CanvasRenderingContext2D, path : Path2D) -> Unit

    CanvasRenderingContext2D::transform

    fn CanvasRenderingContext2D::transform(self : CanvasRenderingContext2D, a : Double, b : Double, c : Double, d : Double, e : Double, f : Double) -> Unit

    CanvasRenderingContext2D::translate

    fn CanvasRenderingContext2D::translate(self : CanvasRenderingContext2D, x : Double, y : Double) -> Unit

    Clipboard

    #external
    pub type Clipboard

    Clipboard::read_text

    Clipboard::write_text

    fn Clipboard::write_text(self : Clipboard, text : String) ->
    Promise

    ClipboardEvent

    type ClipboardEvent

    ClipboardEvent::clipboard_data

    fn ClipboardEvent::clipboard_data(self : ClipboardEvent) -> DataTransfer

    DOMException

    type DOMException

    DOMException::get_message

    fn DOMException::get_message(self : DOMException) -> String

    DOMException::get_name

    fn DOMException::get_name(self : DOMException) -> String

    DOMException::new

    DOMException::new_with_message

    fn DOMException::new_with_message(message : String) -> DOMException

    DOMException::new_with_message_and_name

    fn DOMException::new_with_message_and_name(message : String, name : String) -> DOMException

    DOMMatrix2DInit

    type DOMMatrix2DInit

    DOMRect

    type DOMRect

    DOMRect::get_bottom

    fn DOMRect::get_bottom(self : DOMRect) -> Double

    DOMRect::get_height

    fn DOMRect::get_height(self : DOMRect) -> Double

    DOMRect::get_left

    fn DOMRect::get_left(self : DOMRect) -> Double

    DOMRect::get_right

    fn DOMRect::get_right(self : DOMRect) -> Double

    DOMRect::get_top

    fn DOMRect::get_top(self : DOMRect) -> Double

    DOMRect::get_width

    fn DOMRect::get_width(self : DOMRect) -> Double

    DOMRect::get_x

    fn DOMRect::get_x(self : DOMRect) -> Double

    DOMRect::get_y

    fn DOMRect::get_y(self : DOMRect) -> Double

    DataTransfer

    type DataTransfer

    DataTransfer::drop_effect

    fn DataTransfer::drop_effect(self : DataTransfer) -> String

    DataTransfer::effect_allowed

    fn DataTransfer::effect_allowed(self : DataTransfer) -> String

    DataTransfer::items

    DataTransfer::set_drog_image

    fn DataTransfer::set_drog_image(self : DataTransfer, image : Element, x : Int, y : Int) -> Unit

    DataTransferItemList

    type DataTransferItemList

    DataTransferItemList::add

    fn DataTransferItemList::add(self : DataTransferItemList, data : String, type_ : String) -> Unit

    DataTransferItemList::clear

    fn DataTransferItemList::clear(self : DataTransferItemList) -> Unit

    DataTransferItemList::length

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

    DataTransferItemList::op_get

    fn DataTransferItemList::op_get(self : DataTransferItemList, index : Int) -> Unit

    DataTransferItemList::remove

    fn DataTransferItemList::remove(self : DataTransferItemList, index : Int) -> Unit

    Document

    type Document

    Document::create_document_fragment

    fn Document::create_document_fragment(self : Document) -> DocumentFragment

    Document::create_element

    fn Document::create_element(self : Document, tag : String) -> Element

    Document::create_element_ns

    fn Document::create_element_ns(self : Document, namespace_uri : String, qualified_name : String, on_namespace_error~ : (DOMException) -> Element = .., on_invalid_character_error~ : (DOMException) -> Element = ..) -> Element

    Document::create_text_node

    fn Document::create_text_node(self : Document, str : String) -> Element

    Document::get_element_by_id

    fn Document::get_element_by_id(self : Document, id : String) ->
    Nullable
    [Element]
    https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById

    Document::get_elements_by_class_name

    fn Document::get_elements_by_class_name(self : Document, names : String) -> HTMLCollection
    https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName

    Document::get_elements_by_name

    fn Document::get_elements_by_name(self : Document, name : String) -> NodeList
    https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName

    Document::get_elements_by_tag_name

    fn Document::get_elements_by_tag_name(self : Document, tag : String) -> HTMLCollection
    https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagName

    Document::get_elements_by_tag_name_ns

    fn Document::get_elements_by_tag_name_ns(self : Document, namespace_ : String, name : String) -> HTMLCollection
    https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagNameNS

    Document::query_selector

    fn Document::query_selector(self : Document, selectors : String) ->
    Nullable
    [Element]
    https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector

    Document::query_selector_all

    fn Document::query_selector_all(self : Document, selectors : String) -> NodeList
    https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll

    Document::to_node

    fn Document::to_node(self : Document) -> Node

    DocumentFragment

    type DocumentFragment

    DocumentFragment::to_node

    fn DocumentFragment::to_node(self : DocumentFragment) -> Node

    Element

    type Element

    Element::append_children

    fn Element::append_children(self : Element, child : Element) -> Unit

    Element::children

    fn Element::children(self : Element) -> Array[Element]

    Element::get_attribute

    fn Element::get_attribute(self : Element, attr : String) -> String

    Element::get_bounding_client_rect

    fn Element::get_bounding_client_rect(self : Element) -> DOMRect

    Element::get_property

    fn Element::get_property(self : Element, prop : String) -> String

    Element::get_scroll_height

    fn Element::get_scroll_height(self : Element) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight

    Element::get_scroll_left

    fn Element::get_scroll_left(self : Element) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft

    Element::get_scroll_top

    fn Element::get_scroll_top(self : Element) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop

    Element::get_scroll_width

    fn Element::get_scroll_width(self : Element) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth

    Element::remove_attribute

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

    Element::remove_children

    fn Element::remove_children(self : Element, child : Element) -> Unit

    Element::remove_property

    fn Element::remove_property(self : Element, prop : String) -> Unit

    Element::scroll_into_view

    fn Element::scroll_into_view(self : Element) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

    Element::set_attribute

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

    Element::set_inner_html

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

    Element::set_property

    fn Element::set_property(self : Element, prop : String, value :
    Value
    ) -> Unit

    Element::set_scroll_left

    fn Element::set_scroll_left(self : Element, value : Double) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft

    Element::set_scroll_top

    fn Element::set_scroll_top(self : Element, value : Double) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop

    Element::to_html_element

    Element::to_node

    fn Element::to_node(self : Element) -> Node

    Event

    type Event

    Event::prevent_default

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

    Event::stop_propagation

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

    Event::target

    fn Event::target(self : Event) -> EventTarget

    Event::to_clipboard_event

    fn Event::to_clipboard_event(self : Event) ->
    Nullable
    [KeyboardEvent]

    Event::to_ui_event

    EventTarget

    type EventTarget

    EventTarget::add_event_listener

    fn EventTarget::add_event_listener(self : EventTarget, type_ : String, callback : (Event) -> Unit) -> Unit

    EventTarget::dispatch_event

    fn EventTarget::dispatch_event(self : EventTarget, event : Event) -> Unit

    EventTarget::remove_event_listener

    fn EventTarget::remove_event_listener(self : EventTarget, type_ : String, callback : (Event) -> Unit) -> Unit

    EventTarget::to_clipboard

    EventTarget::to_node

    FocusEvent

    type FocusEvent

    FocusEvent::related_target

    fn FocusEvent::related_target(self : FocusEvent) -> EventTarget

    GPUCanvasContext

    type GPUCanvasContext

    HTMLCanvasElement

    type HTMLCanvasElement

    HTMLCanvasElement::get_height

    fn HTMLCanvasElement::get_height(self : HTMLCanvasElement) -> Int

    HTMLCanvasElement::get_width

    fn HTMLCanvasElement::get_width(self : HTMLCanvasElement) -> Int

    HTMLCanvasElement::to_html_element

    fn HTMLCanvasElement::to_html_element(self : HTMLCanvasElement) -> HTMLElement

    HTMLCollection

    type HTMLCollection
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection

    HTMLCollection::get_length

    fn HTMLCollection::get_length(self : HTMLCollection) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/length

    HTMLCollection::item

    https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/item

    HTMLCollection::named_item

    https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/namedItem

    HTMLDialogElement

    type HTMLDialogElement

    HTMLDialogElement::close

    fn HTMLDialogElement::close(self : HTMLDialogElement, return_value~ :
    Optional
    [String] = ..) -> Unit

    HTMLDialogElement::open

    fn HTMLDialogElement::open(self : HTMLDialogElement) -> Bool

    HTMLDialogElement::request_close

    fn HTMLDialogElement::request_close(self : HTMLDialogElement, return_value~ :
    Optional
    [String] = ..) -> Unit

    HTMLDialogElement::return_value

    fn HTMLDialogElement::return_value(self : HTMLDialogElement) -> String

    HTMLDialogElement::show

    fn HTMLDialogElement::show(self : HTMLDialogElement) -> Unit

    HTMLDialogElement::show_modal

    fn HTMLDialogElement::show_modal(self : HTMLDialogElement) -> Unit

    HTMLElement

    type HTMLElement

    HTMLElement::remove_style

    fn HTMLElement::remove_style(self : HTMLElement, key : String) -> Unit

    HTMLElement::set_style

    fn HTMLElement::set_style(self : HTMLElement, key : String, value : String) -> Unit

    HTMLElement::to_element

    fn HTMLElement::to_element(self : HTMLElement) -> Element

    HTMLElement::to_html_canvas_element

    HTMLElement::to_html_dialog_element

    HTMLElement::to_html_image_element

    HTMLElement::to_html_input_element

    HTMLElement::to_html_select_element

    HTMLImageElement

    type HTMLImageElement
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchPriority

    HTMLImageElement::get_alt

    fn HTMLImageElement::get_alt(self : HTMLImageElement) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt

    HTMLImageElement::get_complete

    fn HTMLImageElement::get_complete(self : HTMLImageElement) -> Bool
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/complete

    HTMLImageElement::get_cross_origin

    fn HTMLImageElement::get_cross_origin(self : HTMLImageElement) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin

    HTMLImageElement::get_current_src

    fn HTMLImageElement::get_current_src(self : HTMLImageElement) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/currentSrc

    HTMLImageElement::get_decoding

    fn HTMLImageElement::get_decoding(self : HTMLImageElement) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decoding

    HTMLImageElement::get_height

    fn HTMLImageElement::get_height(self : HTMLImageElement) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/height

    HTMLImageElement::get_is_map

    fn HTMLImageElement::get_is_map(self : HTMLImageElement) -> Bool
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/isMap

    HTMLImageElement::get_loading

    fn HTMLImageElement::get_loading(self : HTMLImageElement) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/loading

    HTMLImageElement::get_natural_height

    fn HTMLImageElement::get_natural_height(self : HTMLImageElement) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/naturalHeight

    HTMLImageElement::get_natural_width

    fn HTMLImageElement::get_natural_width(self : HTMLImageElement) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/naturalWidth

    HTMLImageElement::get_referrer_policy

    fn HTMLImageElement::get_referrer_policy(self : HTMLImageElement) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/referrerPolicy

    HTMLImageElement::get_sizes

    fn HTMLImageElement::get_sizes(self : HTMLImageElement) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes

    HTMLImageElement::get_src

    fn HTMLImageElement::get_src(self : HTMLImageElement) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/src

    HTMLImageElement::get_srcset

    fn HTMLImageElement::get_srcset(self : HTMLImageElement) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset

    HTMLImageElement::get_use_map

    fn HTMLImageElement::get_use_map(self : HTMLImageElement) -> String
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/useMap

    HTMLImageElement::get_width

    fn HTMLImageElement::get_width(self : HTMLImageElement) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/width

    HTMLImageElement::get_x

    fn HTMLImageElement::get_x(self : HTMLImageElement) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/x

    HTMLImageElement::get_y

    fn HTMLImageElement::get_y(self : HTMLImageElement) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/y

    HTMLImageElement::new

    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image

    HTMLImageElement::new_with_size

    fn HTMLImageElement::new_with_size(width : Double, height : Double) -> HTMLImageElement
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image

    HTMLImageElement::set_alt

    fn HTMLImageElement::set_alt(self : HTMLImageElement, value : String) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt

    HTMLImageElement::set_cross_origin

    fn HTMLImageElement::set_cross_origin(self : HTMLImageElement, value : String) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin

    HTMLImageElement::set_decoding

    fn HTMLImageElement::set_decoding(self : HTMLImageElement, value : String) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decoding

    HTMLImageElement::set_height

    fn HTMLImageElement::set_height(self : HTMLImageElement, value : Double) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/height

    HTMLImageElement::set_is_map

    fn HTMLImageElement::set_is_map(self : HTMLImageElement, value : Bool) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/isMap

    HTMLImageElement::set_loading

    fn HTMLImageElement::set_loading(self : HTMLImageElement, value : String) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/loading

    HTMLImageElement::set_natural_height

    fn HTMLImageElement::set_natural_height(self : HTMLImageElement, value : Double) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/naturalHeight

    HTMLImageElement::set_natural_width

    fn HTMLImageElement::set_natural_width(self : HTMLImageElement, value : Double) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/naturalWidth

    HTMLImageElement::set_referrer_policy

    fn HTMLImageElement::set_referrer_policy(self : HTMLImageElement, value : String) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/referrerPolicy

    HTMLImageElement::set_sizes

    fn HTMLImageElement::set_sizes(self : HTMLImageElement, value : String) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes

    HTMLImageElement::set_src

    fn HTMLImageElement::set_src(self : HTMLImageElement, value : String) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/src

    HTMLImageElement::set_srcset

    fn HTMLImageElement::set_srcset(self : HTMLImageElement, value : String) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset

    HTMLImageElement::set_use_map

    fn HTMLImageElement::set_use_map(self : HTMLImageElement, value : String) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/useMap

    HTMLImageElement::set_width

    fn HTMLImageElement::set_width(self : HTMLImageElement, value : Double) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/width

    HTMLInputElement

    type HTMLInputElement

    HTMLInputElement::value

    fn HTMLInputElement::value(self : HTMLInputElement) -> String

    HTMLSelectElement

    type HTMLSelectElement

    HTMLSelectElement::value

    fn HTMLSelectElement::value(self : HTMLSelectElement) -> String

    HTMLVideoElement

    type HTMLVideoElement

    ImageBitmap

    type ImageBitmap

    ImageBitmapRenderingContext

    type ImageBitmapRenderingContext

    ImageData

    type ImageData

    ImageData::get_color_space

    fn ImageData::get_color_space(self : ImageData) -> String

    ImageData::get_data

    fn ImageData::get_data(self : ImageData) -> Uint8ClampedArray

    ImageData::get_height

    fn ImageData::get_height(self : ImageData) -> Int

    ImageData::get_width

    fn ImageData::get_width(self : ImageData) -> Int

    ImageData::new

    fn ImageData::new(sw : Int, sh : Int, settings :
    Optional
    [ImageDataSettings]) -> ImageData

    ImageData::new_with_data

    fn ImageData::new_with_data(data : Uint8ClampedArray, sw : Int, sh : Int, settings~ :
    Optional
    [ImageDataSettings] = ..) -> ImageData

    ImageDataSettings

    type ImageDataSettings

    ImageDataSettings::new

    fn ImageDataSettings::new(color_space : String) -> ImageDataSettings

    InputEvent

    type InputEvent

    InputEvent::data

    fn InputEvent::data(self : InputEvent) -> String

    InputEvent::input_type

    fn InputEvent::input_type(self : InputEvent) -> String

    InputEvent::is_composing

    fn InputEvent::is_composing(self : InputEvent) -> Bool

    KeyboardEvent

    type KeyboardEvent

    KeyboardEvent::alt_key

    fn KeyboardEvent::alt_key(self : KeyboardEvent) -> Bool

    KeyboardEvent::code

    fn KeyboardEvent::code(self : KeyboardEvent) -> String

    KeyboardEvent::ctrl_key

    fn KeyboardEvent::ctrl_key(self : KeyboardEvent) -> Bool

    KeyboardEvent::is_composing

    fn KeyboardEvent::is_composing(self : KeyboardEvent) -> Bool

    KeyboardEvent::key

    fn KeyboardEvent::key(self : KeyboardEvent) -> String

    KeyboardEvent::location

    fn KeyboardEvent::location(self : KeyboardEvent) -> Int

    KeyboardEvent::meta_key

    fn KeyboardEvent::meta_key(self : KeyboardEvent) -> Bool

    KeyboardEvent::repeat

    fn KeyboardEvent::repeat(self : KeyboardEvent) -> Bool

    KeyboardEvent::shift_key

    fn KeyboardEvent::shift_key(self : KeyboardEvent) -> Bool

    MouseEvent

    type MouseEvent

    MouseEvent::alt_key

    fn MouseEvent::alt_key(self : MouseEvent) -> Bool

    MouseEvent::client_x

    fn MouseEvent::client_x(self : MouseEvent) -> Int

    MouseEvent::client_y

    fn MouseEvent::client_y(self : MouseEvent) -> Int

    MouseEvent::ctrl_key

    fn MouseEvent::ctrl_key(self : MouseEvent) -> Bool

    MouseEvent::meta_key

    fn MouseEvent::meta_key(self : MouseEvent) -> Bool

    MouseEvent::offset_x

    fn MouseEvent::offset_x(self : MouseEvent) -> Int

    MouseEvent::offset_y

    fn MouseEvent::offset_y(self : MouseEvent) -> Int

    MouseEvent::screen_x

    fn MouseEvent::screen_x(self : MouseEvent) -> Int

    MouseEvent::screen_y

    fn MouseEvent::screen_y(self : MouseEvent) -> Int

    MouseEvent::shift_key

    fn MouseEvent::shift_key(self : MouseEvent) -> Bool

    #external
    pub type Navigator

    fn Navigator::clipboard(self : Navigator) -> Clipboard

    Node

    type Node

    Node::append_child

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

    Node::count_child

    fn Node::count_child(self : Node) -> Int

    Node::first_child

    fn Node::first_child(self : Node) -> Node

    Node::insert_before

    fn Node::insert_before(self : Node, value : Node, before : Node) -> Unit

    Node::last_child

    fn Node::last_child(self : Node) -> Node

    Node::next_sibling

    fn Node::next_sibling(self : Node) -> Node

    Node::node_name

    fn Node::node_name(self : Node) -> String

    Node::node_type

    fn Node::node_type(self : Node) -> Int

    Node::node_value

    fn Node::node_value(self : Node) -> String

    Node::nth_child

    fn Node::nth_child(self : Node, index : Int) -> Node

    Node::parent_node

    fn Node::parent_node(self : Node) -> Node

    Node::previous_sibling

    fn Node::previous_sibling(self : Node) -> Node

    Node::remove_child

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

    Node::replace_child

    fn Node::replace_child(self : Node, new : Node, old : Node) -> Unit

    Node::to_document

    Node::to_document_fragment

    fn Node::to_document_fragment(self : Node) ->
    Nullable
    [DocumentFragment]

    Node::to_element

    Node::to_event_target

    fn Node::to_event_target(self : Node) -> EventTarget

    Node::to_text

    NodeList

    type NodeList
    https://developer.mozilla.org/en-US/docs/Web/API/NodeList

    NodeList::get_length

    fn NodeList::get_length(self : NodeList) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/NodeList/length

    NodeList::item

    fn NodeList::item(self : NodeList, index : Double) ->
    Nullable
    [Node]
    https://developer.mozilla.org/en-US/docs/Web/API/NodeList/item

    OffscreenCanvas

    type OffscreenCanvas

    Path2D

    type Path2D

    Path2D::add_path

    fn Path2D::add_path(self : Path2D, path : Path2D, transform~ :
    Optional
    [DOMMatrix2DInit] = ..) -> Unit

    SVGImageElement

    type SVGImageElement

    Text

    type Text

    Text::to_node

    fn Text::to_node(self : Text) -> Node

    UIEvent

    type UIEvent

    UIEvent::to_event

    fn UIEvent::to_event(self : UIEvent) -> Event

    UIEvent::to_focus_event

    UIEvent::to_input_event

    UIEvent::to_keyboard_event

    UIEvent::to_mouse_event

    Uint8ClampedArray

    type Uint8ClampedArray

    VideoFrame

    type VideoFrame

    WebGL2RenderingContext

    type WebGL2RenderingContext

    WebGLRenderingContext

    type WebGLRenderingContext

    Window

    type Window

    Window::alert

    fn Window::alert(self : Window, msg : String) -> Unit

    Window::cancel_animation_frame

    fn Window::cancel_animation_frame(self : Window, request_id : Double) -> Unit
    https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame

    Window::confirm

    fn Window::confirm(self : Window, msg : String) -> Bool

    Window::current_url

    fn Window::current_url(self : Window) -> String

    Window::history_go_back

    fn Window::history_go_back(self : Window) -> Unit

    Window::history_go_forward

    fn Window::history_go_forward(self : Window) -> Unit

    Window::load_url

    fn Window::load_url(self : Window, url : String) -> Unit

    Window::navigator

    fn Window::navigator(self : Window) -> Navigator

    Window::push_url

    fn Window::push_url(self : Window, url : String) -> Unit

    Window::reload_url

    fn Window::reload_url(self : Window) -> Unit

    Window::replace_url

    fn Window::replace_url(self : Window, url : String) -> Unit

    Window::request_animation_frame

    fn Window::request_animation_frame(self : Window, f : (Double) -> Unit) -> Double
    https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame

    Window::scroll_by

    fn Window::scroll_by(self : Window, x : Int, y : Int) -> Unit

    Window::scroll_to

    fn Window::scroll_to(self : Window, x : Int, y : Int) -> Unit

    Window::scroll_to_bottom

    fn Window::scroll_to_bottom(self : Window) -> Unit

    Window::scroll_to_top

    fn Window::scroll_to_top(self : Window) -> Unit

    Window::to_event_target

    fn Window::to_event_target(self : Window) -> EventTarget

    DOM_KEY_LOCATION_LEFT

    let DOM_KEY_LOCATION_LEFT : Int

    DOM_KEY_LOCATION_NUMPAD

    let DOM_KEY_LOCATION_NUMPAD : Int

    DOM_KEY_LOCATION_RIGHT

    let DOM_KEY_LOCATION_RIGHT : Int

    DOM_KEY_LOCATION_STANDARD

    let DOM_KEY_LOCATION_STANDARD : Int

    default_exception_handler

    fn[E, R] default_exception_handler(exception : E) -> R
    DO NOT USE THIS FUNCTION. NOTE: There is a bug in the unused analyzer, so make this function public to avoid the warning.

    document

    fn document() -> Document

    namespace_html

    let namespace_html : String

    namespace_mathml

    let namespace_mathml : String

    namespace_svg

    let namespace_svg : String

    window

    fn window() -> Window