Crate ironhtml_attributes

Crate ironhtml_attributes 

Source
Expand description

§ironhtml-attributes

Type-safe HTML5 attributes following the WHATWG HTML Living Standard.

This crate provides traits for global and element-specific attributes, with type-safe enums for constrained attribute values.

§Example

use ironhtml_attributes::{AttributeValue, InputType, Target, Loading, Method};

// Use type-safe enums for attribute values
let input_type = InputType::Email;
assert_eq!(input_type.to_attr_value(), "email");

let target = Target::Blank;
assert_eq!(target.to_attr_value(), "_blank");

// Access attribute names as constants
use ironhtml_attributes::{global, anchor, img};
assert_eq!(global::CLASS, "class");
assert_eq!(anchor::HREF, "href");
assert_eq!(img::LOADING, "loading");

§Specification References

Modules§

anchor
Attribute names for anchor (<a>) elements.
button
Attribute names for button (<button>) elements.
form
Attribute names for form (<form>) elements.
global
Attribute names for global HTML attributes.
iframe
Attribute names for iframe (<iframe>) elements.
img
Attribute names for image (<img>) elements.
input
Attribute names for input (<input>) elements.
label
Attribute names for label (<label>) elements.
link
Attribute names for link (<link>) elements.
media
Attribute names for media (<audio>, <video>) elements.
meta
Attribute names for meta (<meta>) elements.
option
Attribute names for option (<option>) elements.
script
Attribute names for script (<script>) elements.
select
Attribute names for select (<select>) elements.
source
Attribute names for source (<source>) elements.
style
Attribute names for style (<style>) elements.
table
Attribute names for table (<table>) elements.
tablecell
Attribute names for table cell (<td>, <th>) elements.
textarea
Attribute names for textarea (<textarea>) elements.
track
Attribute names for track (<track>) elements.

Enums§

Autocomplete
The autocomplete attribute values.
ButtonType
The type attribute values for <button> elements.
ContentEditable
The contenteditable attribute values.
CrossOrigin
The crossorigin attribute values for CORS requests.
Decoding
The decoding attribute values for image decoding.
Dir
The dir attribute values for text directionality.
Draggable
The draggable attribute values.
Enctype
The enctype attribute values for form encoding.
Hidden
The hidden attribute values.
InputType
The type attribute values for <input> elements.
Loading
The loading attribute values for lazy-loading resources.
Method
The method attribute values for <form> elements.
Preload
The preload attribute values for media elements.
ReferrerPolicy
The referrerpolicy attribute values.
Rel
The rel attribute values for link relationships.
Sandbox
The sandbox attribute values for <iframe> elements.
Scope
The scope attribute values for table header cells.
Spellcheck
The spellcheck attribute values.
Target
The target attribute values for hyperlinks and forms.
TrackKind
The kind attribute values for <track> elements.
Translate
The translate attribute values.
Wrap
The wrap attribute values for <textarea> elements.

Traits§

AttributeValue
A trait for types that can be converted to an attribute value string.