(hiccup? sexp)
Returns true
if sexp
is a vector with a keyword in the first position.
Returns `true` if `sexp` is a vector with a keyword in the first position.
(set-attr hiccup attr v)
Set attribute attr
on the hiccup
node to v
. Updates the attribute map
if it exists, otherwise inserts one.
(set-attr [:h1 "Hello"] :title "Hi")
;;=> [:h1 {:title "Hi"} "Hello"]
(set-attr [:h1 {:title "Hello"} "Hello"] :title "Hi")
;;=> [:h1 {:title "Hi"} "Hello"]
Set attribute `attr` on the `hiccup` node to `v`. Updates the attribute map if it exists, otherwise inserts one. ```clj (set-attr [:h1 "Hello"] :title "Hi") ;;=> [:h1 {:title "Hi"} "Hello"] (set-attr [:h1 {:title "Hello"} "Hello"] :title "Hi") ;;=> [:h1 {:title "Hi"} "Hello"] ```
(update-attrs hiccup & args)
Ensure that hiccup
has an attribute map, and call update
on it with args
.
(update-attrs [:h1 "Hello"] assoc :title "Hi")
;;=> [:h1 {:title "Hi"} "Hello"]
(update-attrs [:h1 {:title "Hello"} "Hello"] dissoc :title)
;;=> [:h1 {} "Hello"]
Ensure that `hiccup` has an attribute map, and call `update` on it with `args`. ```clj (update-attrs [:h1 "Hello"] assoc :title "Hi") ;;=> [:h1 {:title "Hi"} "Hello"] (update-attrs [:h1 {:title "Hello"} "Hello"] dissoc :title) ;;=> [:h1 {} "Hello"] ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close