pub trait HtmlElement: Element {
Show 19 methods
// Provided methods
fn hidden(&self) -> bool { ... }
fn set_hidden(&self, hidden: bool) { ... }
fn title(&self) -> String { ... }
fn set_title(&self, title: impl Into<String>) { ... }
fn lang(&self) -> String { ... }
fn set_lang(&self, lang: impl Into<String>) { ... }
fn dir(&self) -> String { ... }
fn set_dir(&self, dir: impl Into<String>) { ... }
fn tab_index(&self) -> i32 { ... }
fn set_tab_index(&self, index: i32) { ... }
fn draggable(&self) -> bool { ... }
fn set_draggable(&self, draggable: bool) { ... }
fn spellcheck(&self) -> bool { ... }
fn set_spellcheck(&self, spellcheck: bool) { ... }
fn collect_presentation_styles(&self) { ... }
fn attribute_changed(
&self,
_name: &str,
_old: Option<&str>,
_new: Option<&str>,
) { ... }
fn click(&self) { ... }
fn focus(&self) { ... }
fn blur(&self) { ... }
}Expand description
Shared behavior for all HTML elements.
Every method has a default implementation that reads/writes attributes
through the Element trait. Concrete elements inherit all behavior
and override only what they need.
HtmlDivElement overrides: presentation_style() (for legacy align).
HtmlButtonElement overrides: nothing (adds props via ButtonData instead).
Provided Methods§
The hidden attribute. Elements with hidden should not be rendered.
fn set_title(&self, title: impl Into<String>)
fn set_lang(&self, lang: impl Into<String>)
fn set_dir(&self, dir: impl Into<String>)
Sourcefn tab_index(&self) -> i32
fn tab_index(&self) -> i32
The tabindex attribute. Controls focus order.
Returns the element’s default if not explicitly set.
fn set_tab_index(&self, index: i32)
fn set_draggable(&self, draggable: bool)
Sourcefn spellcheck(&self) -> bool
fn spellcheck(&self) -> bool
The spellcheck attribute.
fn set_spellcheck(&self, spellcheck: bool)
Sourcefn collect_presentation_styles(&self)
fn collect_presentation_styles(&self)
Map presentation attributes to a PropertyDeclarationBlock.
Like Chrome’s CollectStyleForPresentationAttribute. Override in elements
that expose legacy presentation attributes (e.g. align, width, color).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.