diff --git a/CHANGELOG.md b/CHANGELOG.md index 4030aa1..a8269f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ## Fixed +- Correctly handle boolean attributes (false values are removed rather than being set to "false") + ## Changed # 0.0.4 (2021-10-28 / 8c0198a) @@ -13,4 +15,4 @@ - Initial implementation - fragment support - component support (fn? in first vector position) -- unsafe-html support \ No newline at end of file +- unsafe-html support diff --git a/src/lambdaisland/hiccup.clj b/src/lambdaisland/hiccup.clj index 08e1f97..185d52f 100644 --- a/src/lambdaisland/hiccup.clj +++ b/src/lambdaisland/hiccup.clj @@ -38,7 +38,10 @@ classes (keep (fn [^String seg] (when (= \. (.charAt seg 0)) (subs seg 1))) segments) - node {:tag (keyword tag-name) :attrs (if (attr-map? m) m {}) + node {:tag (keyword tag-name) + :attrs (if (attr-map? m) + (into {} (filter val m)) + {}) :content (enlive/flatmap #(nodify % opts) (if (attr-map? m) ms more))} node (if id (assoc-in node [:attrs :id] id) node) node (if (seq classes)