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
autocompleteattribute values. - Button
Type - The
typeattribute values for<button>elements. - Content
Editable - The
contenteditableattribute values. - Cross
Origin - The
crossoriginattribute values for CORS requests. - Decoding
- The
decodingattribute values for image decoding. - Dir
- The
dirattribute values for text directionality. - Draggable
- The
draggableattribute values. - Enctype
- The
enctypeattribute values for form encoding. - Hidden
- The
hiddenattribute values. - Input
Type - The
typeattribute values for<input>elements. - Loading
- The
loadingattribute values for lazy-loading resources. - Method
- The
methodattribute values for<form>elements. - Preload
- The
preloadattribute values for media elements. - Referrer
Policy - The
referrerpolicyattribute values. - Rel
- The
relattribute values for link relationships. - Sandbox
- The
sandboxattribute values for<iframe>elements. - Scope
- The
scopeattribute values for table header cells. - Spellcheck
- The
spellcheckattribute values. - Target
- The
targetattribute values for hyperlinks and forms. - Track
Kind - The
kindattribute values for<track>elements. - Translate
- The
translateattribute values. - Wrap
- The
wrapattribute values for<textarea>elements.
Traits§
- Attribute
Value - A trait for types that can be converted to an attribute value string.