weavejester / hiccup

Fast library for rendering HTML in Clojure
http://weavejester.github.io/hiccup
Eclipse Public License 1.0
2.68k stars 174 forks source link

Using both the class dot notation and attribute map prevents evaluation of local variables #143

Open benzap opened 7 years ago

benzap commented 7 years ago

The code

(let [class-local-var "class-foo class-bar"]
  (hiccup.page/html5 
   [:body
    [:div.test {:class class-local-var}]]))

Expected output

<!DOCTYPE html>
<html><body><div class="test class-foo class-bar"></div></body></html>

Actual output

<!DOCTYPE html>
<html><body><div class="test class-local-var"></div></body></html>

Note that the symbol class-local-var was not evaluated into class-foo class-bar

Tested on Version 1.0.5

benzap commented 7 years ago

This only appears to happen when you include a class with dot notation and through the map attributes :class keyword. The workaround currently would be to only use dot notation or only using map attributes until this is fixed.