lambdaisland / hiccup

Enlive-backed Hiccup implementation (clj-only)
Mozilla Public License 2.0
28 stars 4 forks source link

Classes in tags rendered incorrectly #7

Closed mike706574 closed 1 year ago

mike706574 commented 1 year ago

I'm using version 0.0.25, and classes specified in tags aren't being rendered correctly:

user> (require '[lambdaisland.hiccup :as hiccup])
nil
user> (hiccup/render [:div.foo] {:doctype? false})
"<div class=\"clojure.lang.LazySeq@18ce5\"></div>"

Some test cases that would currently fail if added:

(testing "classes in tags"
  (is (= (hiccup/render [:div.foo] {:doctype? false})
         "<div class=\"foo\"></div>"))

  (is (= (hiccup/render [:div.foo.bar] {:doctype? false})
         "<div class=\"foo bar\"></div>"))

  (is (= (hiccup/render [:div.foo {:class "bar"}] {:doctype? false})
         "<div class=\"foo bar\"></div>"))

  (is (= (hiccup/render [:div.foo {:class "foo"}] {:doctype? false})
         "<div class=\"foo foo\"></div>")))

In lambdaisland.hiccup/nodify, it looks like classes from the tag get included in the value for the keyword attribute :class, but the string attribute "class" is the one that gets joined to create a valid class value.

oxalorg commented 1 year ago

Thanks for creating the issue @mike706574 🙌

Just confirmed that yes this is happening in 0.0.25 but was not happening in 5db0e3436fc70ad0a09db375f7bdb5c19b21b722 which was before the #5 PR got merged in.

oxalorg commented 1 year ago

Merged PR, and released a new version. Fix is now available:

com.lambdaisland/hiccup {:mvn/version "0.0.33"}
mike706574 commented 1 year ago

Merged PR, and released a new version. Fix is now available:

com.lambdaisland/hiccup {:mvn/version "0.0.33"}

Thanks!