weavejester / hiccup

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

Null pointer exception with `:class` attribute containing vector nil #168

Closed kwrooijen closed 2 years ago

kwrooijen commented 4 years ago

The following fails with a null pointer exception

(hiccup/html [:div.foo {:class [nil]}])

I'll check this out (hopefully) tomorrow

weavejester commented 4 years ago

(map name classes) probably needs to be changed to (map to-str classes).

kwrooijen commented 4 years ago

to-str causes the nils to become empty string. Then when we join them we get extra spaces. Not sure if this is desirable? Maybe it's better to filter the nils instead. If the extra spaces (which technically don't matter) are fine the we can make this simple change

weavejester commented 4 years ago

Joining to get multiple spaces is fine. The output from Hiccup is not prettified.