Expand description
HTML element types.
Each HTML element has an associated struct. For example, the <a>
element
is represented by html::A
. The constructor is a free function of the
same name, so you can write a()
rather than A::new()
. There are methods
for each attribute and event. Event methods are prefixed with on_
. For
example:
let link: A = a()
.href("https://example.com/")
.on_click(|event, element| {});
The element type implements various traits, including:
Element
HtmlElement
HtmlElementEvents
ElementEvents
ParentElement
(if it is a parent element)ShadowRootParent
(if it’s allowed to have a shadow root attached)
Each element can be frozen, making it immutable, using the freeze
method.
Modules§
- HTML elements
- SVG Elements
Structs§
- Wrap a
web_sys::CustomEvent
.
Traits§
- ARIA attributes.
- Events common to all elements
- An HTML element
- Events common to all HTML elements