weavejester / hiccup

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

Fix :class conversion in vector containing nil #180

Closed stefanvanburen closed 2 years ago

stefanvanburen commented 3 years ago

Fixes #168.

Feel free to suggest a better commit message or further tests; I've just added a simple test here.

weavejester commented 2 years ago

What about changing map to keep, instead?

stefanvanburen commented 2 years ago

@weavejester swapped map for keep, but I don't think it affects the output since util/to-str converts nil to "".

weavejester commented 2 years ago

Ah, right, it would have to be (keep #(some-> % name) ...).

I'm a little leery about using util/to-str in this case as it might swallow errors or prevent future syntax sugar. Using #(some-> % name) instead solves the bug without allowing additional data types.

stefanvanburen commented 2 years ago

@weavejester ah yep, that'll do it. Changed the implementation and updated the tests (no extra spaces anymore).