Module: Dommy::Internal::ReflectedAttributes

Included in:
HTMLElement, SVGElement
Defined in:
lib/dommy/internal/reflected_attributes.rb

Overview

IDL-attribute reflection helpers for ‘HTMLElement` and `SVGElement` subclasses. Each helper delegates to the host element’s standard attribute API (‘get_attribute` / `set_attribute` / `has_attribute?` / `remove_attribute`), so case-sensitivity is naturally inherited from the host element’s namespace — HTML lowercases, SVG keeps the spec name (‘viewBox`).

Two reflection styles:

  • String: the property mirrors the attribute value verbatim. Missing → ‘“”` (not nil), so subclasses don’t need defensive ‘.to_s`.

  • Boolean: the property is true iff the attribute is present (value ignored). Setting to true writes an empty string; setting to false removes the attribute.