Trait hypertext::GlobalAttributes
source · pub trait GlobalAttributes {
Show 27 associated constants and 0 method
const access_key: Attribute = Attribute;
const autocapitalize: Attribute = Attribute;
const autofocus: Attribute = Attribute;
const class: Attribute = Attribute;
const contenteditable: Attribute = Attribute;
const dir: Attribute = Attribute;
const draggable: Attribute = Attribute;
const enterkeyhint: Attribute = Attribute;
const hidden: Attribute = Attribute;
const id: Attribute = Attribute;
const inert: Attribute = Attribute;
const inputmode: Attribute = Attribute;
const is: Attribute = Attribute;
const itemid: Attribute = Attribute;
const itemprop: Attribute = Attribute;
const itemref: Attribute = Attribute;
const itemscope: Attribute = Attribute;
const itemtype: Attribute = Attribute;
const lang: Attribute = Attribute;
const nonce: Attribute = Attribute;
const popover: Attribute = Attribute;
const slot: Attribute = Attribute;
const spellcheck: Attribute = Attribute;
const style: Attribute = Attribute;
const tabindex: Attribute = Attribute;
const title: Attribute = Attribute;
const translate: Attribute = Attribute;
}Expand description
Global HTML attributes.
This trait must be in scope to use well-known attributes such as
class and id. This trait is implemented
by every HTML element specified in crate::html_elements.
Usage With Custom Elements
use hypertext::{maud, GlobalAttributes}; // `GlobalAttributes` must be in scope!
mod html_elements {
#![allow(non_camel_case_types)]
pub use hypertext::html_elements::*;
use hypertext::GlobalAttributes;
pub struct custom_element;
impl GlobalAttributes for custom_element {}
}
assert_eq!(
maud! { custom-element title="abc" { "Hello, world!" } }.render(),
r#"<custom-element title="abc">Hello, world!</custom-element>"#,
);Provided Associated Constants§
sourceconst access_key: Attribute = Attribute
const access_key: Attribute = Attribute
Used as a guide for creating a keyboard shortcut that activates or focuses the element.
sourceconst autocapitalize: Attribute = Attribute
const autocapitalize: Attribute = Attribute
The autocapitalization behavior to use when the text is edited through non-keyboard methods.
sourceconst autofocus: Attribute = Attribute
const autofocus: Attribute = Attribute
Indicates whether the element should be automatically focused when the page is loaded.
sourceconst contenteditable: Attribute = Attribute
const contenteditable: Attribute = Attribute
Whether the element is editable.
sourceconst enterkeyhint: Attribute = Attribute
const enterkeyhint: Attribute = Attribute
A hint as to what the enter key should do.
Whether the element is hidden from view.
sourceconst inert: Attribute = Attribute
const inert: Attribute = Attribute
Mark an element and its children as inert, disabling interaction.
sourceconst inputmode: Attribute = Attribute
const inputmode: Attribute = Attribute
Specifies what kind of input mechanism would be most helpful for users entering content.
sourceconst itemref: Attribute = Attribute
const itemref: Attribute = Attribute
A list of additional elements to crawl to find the name-value pairs of the item.
sourceconst nonce: Attribute = Attribute
const nonce: Attribute = Attribute
A cryptographic nonce (“number used once”) which can be used by Content Security Policy to determine whether or not a given fetch will be allowed to proceed.
sourceconst popover: Attribute = Attribute
const popover: Attribute = Attribute
When specified, the element won’t be rendered until it becomes shown, at which point it will be rendered on top of other page content.
sourceconst spellcheck: Attribute = Attribute
const spellcheck: Attribute = Attribute
Whether the element is spellchecked or not.