Skip to main content

Module dom

Module dom 

Source
Expand description

DOM helper utilities.

Convenience functions for common DOM operations.

Structs§

Document
Document represents an HTML document to be manipulated.

Functions§

add_class
Add a class to the element.
children
Get direct element children.
clone_document
Clone a document.
direct_text
Get direct text of element (non-recursive, excludes nested element text).
get_all_attributes
Get all attributes as key-value pairs.
get_attribute
Get attribute value.
has_attribute
Check if attribute exists.
has_class
Check if element has specified class.
inner_html
Get inner HTML content.
is_void_element
Check if element is a void element (self-closing).
matches
Check if element matches a CSS selector.
next_element_sibling
Get next element sibling (skipping text nodes).
outer_html
Get outer HTML content.
parent
Get parent element.
parse
Parse HTML string into Document.
previous_element_sibling
Get previous element sibling (skipping text nodes).
remove
Remove element from DOM.
remove_attribute
Remove attribute.
remove_class
Remove a class from the element.
rename
Rename element tag.
set_attribute
Set attribute value.
tag_name
Get tag name (lowercase).
text_content
Get text content of element (recursive).