Skip to main content

Module attrs

Module attrs 

Source
Expand description

Attribute-name ↔ property-name mapping for irregular HTML attributes. Attribute-name ↔ property-name mapping for irregular HTML attributes.

Some HTML attributes use concatenated lowercase names that do not follow standard camelCase-to-kebab-case conversion rules. This module provides lookup tables covering two categories:

  1. Multi-word ARIA attributes — e.g., aria-describedbyariaDescribedBy, per the ARIAMixin specification.
  2. HTML global/element attributes — e.g., readonlyreadOnly, tabindextabIndex.

Both directions are generated from a single list via [define_attr_property_mappings!] so they cannot drift.

Functions§

attribute_to_camel
Convert an HTML attribute name to its camelCase property name.
attribute_to_property
Map an HTML attribute to its camelCase property name.
camel_to_kebab
Convert a camelCase property name to its HTML attribute name.
property_to_attribute
Map a camelCase property name to its HTML attribute.