domu/document
Functions
pub fn body(
document: EventTargetLike(TagNode(TagDocument(a))),
) -> EventTargetLike(
TagNode(
TagElement(TagHTMLElement(TagHTMLBodyElement(Concrete))),
),
)
Returns the document.body
as an HTMLBodyElement
.
Note that document.body
itself returns null
when the <body>
tag hasn’t been loaded yet.
This function is defined for convenience.
For safer handling, use body_option
instead.
pub fn body_option(
document: EventTargetLike(TagNode(TagDocument(a))),
) -> Option(
EventTargetLike(
TagNode(
TagElement(TagHTMLElement(TagHTMLBodyElement(Concrete))),
),
),
)
Returns the document.body
as an Option(HTMLBodyElement)
.
This function safely handles the case where document.body
is null
.
pub fn create_element(
document: EventTargetLike(TagNode(TagDocument(a))),
tag_name: String,
) -> EventTargetLike(
TagNode(TagElement(TagHTMLElement(Concrete))),
)
pub fn create_element_a(
document: EventTargetLike(TagNode(TagDocument(a))),
) -> EventTargetLike(
TagNode(
TagElement(TagHTMLElement(TagHTMLAnchorElement(Concrete))),
),
)