enlive icon indicating copy to clipboard operation
enlive copied to clipboard

hiccup-style adapter doesn't cope well with transformation results

Open cemerick opened this issue 9 years ago • 2 comments

This was surprising:

> (html (at (html [:a])
          [:a] (content "foo")))
ClassCastException   [trace missing]

(Finding the cause was "fun"; there's no stacktrace because the failure is in the destructuring of the first map element in the vector result of at.)

Anyway, the workaround is easy (seq around the result of at). The impl of nodify should probably fall through to the (sequential? node-spec) case if node-spec is a vector with a map for a first element.

cemerick avatar May 04 '15 01:05 cemerick

Trace back when compiled against clojure 1.7: ClassCastException clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.Named clojure.core/name (core.clj:1524) Incoming...

fdserr avatar Jul 10 '15 00:07 fdserr

Would this fit?

(html (at (html [:a])
             [:a] (content "foo")))

=> ({:tag :a, :attrs {}, :content ("foo")})

fdserr avatar Jul 10 '15 00:07 fdserr