crow/js/dom.crow (source)

node extern

Represents a DOM node.
You can use as-js and treat this as a JS object.

create-node node(tag-name symbol)

Create a new DOM node with the given tag.

create-node node(tag-name symbol, attr symbol[string])

Create a new node with the given tag and HTML attributes.

create-node node(tag-name symbol, attr symbol[string], class-name string, children node array)

create-button node(title string, class-name string, children node array, on-click mut void(void))

style record mut, nominal

set-subscript void(a style, key symbol, value string)

classes record mut, nominal

~= void(a classes, class-name string)

set-classes void(a node, class-names string array)

remove-class void(a node, class-name string)

set-text-content void(a node, text string)

add-event-listener void(a node, event-name string, fn mut void(js-any))

create-input-text node(on-input mut void(js-any), value string)

create-div node()

create-div node(class-name string)

create-div node(class-name string, children node array)

create-span node(class-name string, children node array)

create-span node(class-name string, attr symbol[string], children node array)

create-text-node node(text string)

document node() summon

is-text-node bool(a node)

attributes record mut, nominal

subscript string?(a attributes, attr-name symbol)

set-subscript void(a attributes, attr-name symbol, value string)

value string(a node)

Gets the value for an input node, or "" if it's not an input node.

set-value void(a node, value string)

You can set a 'value' on any node, but it will only make a visual difference for input nodes.

query node?(parent node, selector string)

Calls 'querySelector'

query-all node array(selector string)

child-nodes node array(a node)

element node?(parent node, id string)

Calls 'getElementById'

first-child node?(a node)

on-click void(a node, fn mut void(void)) summon

~= void(a node, b node)

Append a child node.

~~= void(a node, b node array)

Append many child nodes.

set-children void(a node, children node array)

Overwrites any existing child nodes.

remove-all-children void(a node)

define-custom-element void(element-name string, connected mut void(custom-element-node)) summon

define-custom-element void(element-name string, style-sheet string, connected mut void(custom-element-node)) summon

define-custom-element void(element-name string, style-sheet mut string(custom-element-node), connected mut void(custom-element-node)) summon

connected-callback alias

custom-element-node extern

as-node node(a custom-element-node)

attributes attributes(a custom-element-node)

shadow-root node(a custom-element-node)

wait-until-window-loaded void() summon