(error-detail src)Build the event detail map for x-image-error.
Build the event detail map for x-image-error.
(load-detail src natural-w natural-h)Build the event detail map for x-image-load.
Build the event detail map for x-image-load.
(normalize {:keys [src-raw alt-raw alt-present? decorative-present? ratio-raw
fit-raw position-raw loading-raw]})Normalise raw attribute inputs into a stable view-model map.
Input keys: :src-raw string | nil :alt-raw string | nil :alt-present? boolean :decorative-present? boolean :ratio-raw string | nil :fit-raw string | nil :position-raw string | nil :loading-raw string | nil
Output keys: :src string | nil (sanitized; nil when absent/unsafe) :alt string ("" when decorative or absent) :decorative? boolean :ratio-css string | nil ("16 / 9" or nil) :ratio-valid? boolean :fit string (one of fit-values) :position string :loading string ("lazy" | "eager") :warn-alt? boolean (true iff non-decorative AND alt attribute absent)
Normalise raw attribute inputs into a stable view-model map.
Input keys:
:src-raw string | nil
:alt-raw string | nil
:alt-present? boolean
:decorative-present? boolean
:ratio-raw string | nil
:fit-raw string | nil
:position-raw string | nil
:loading-raw string | nil
Output keys:
:src string | nil (sanitized; nil when absent/unsafe)
:alt string ("" when decorative or absent)
:decorative? boolean
:ratio-css string | nil ("16 / 9" or nil)
:ratio-valid? boolean
:fit string (one of fit-values)
:position string
:loading string ("lazy" | "eager")
:warn-alt? boolean (true iff non-decorative AND alt attribute absent)(parse-fit s)Normalise fit attribute. Unknown / nil fall back to "cover".
Normalise fit attribute. Unknown / nil fall back to "cover".
(parse-loading s)Normalise loading attribute. Unknown / nil fall back to "lazy".
Normalise loading attribute. Unknown / nil fall back to "lazy".
(parse-position s)Normalise object-position. Non-empty trimmed string or "center".
Normalise object-position. Non-empty trimmed string or "center".
(parse-ratio s)Parse a ratio string like "16:9" or "16/9" into a CSS aspect-ratio value. Returns {:css <string|nil> :valid? <boolean>}.
Parse a ratio string like "16:9" or "16/9" into a CSS aspect-ratio value.
Returns {:css <string|nil> :valid? <boolean>}.
- nil / "" / "auto" → {:css nil :valid? true} (no explicit ratio)
- valid ratio → {:css "16 / 9" :valid? true}
- invalid → {:css nil :valid? false}(safe-src s)Return sanitized src, or nil when absent/unsafe.
Return sanitized src, or nil when absent/unsafe.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |