diff --git a/src/hiccup/compiler.clj b/src/hiccup/compiler.clj index 791c11c..51d4527 100644 --- a/src/hiccup/compiler.clj +++ b/src/hiccup/compiler.clj @@ -77,6 +77,7 @@ (cond (nil? class) classes (string? class) (str classes " " class) + (symbol? class) (list `str classes " " class) :else (str classes " " (str/join " " class)))) (defn- merge-attributes [map-attrs id classes] diff --git a/test/hiccup/core_test.clj b/test/hiccup/core_test.clj index 3f5cc6d..d6df2b9 100644 --- a/test/hiccup/core_test.clj +++ b/test/hiccup/core_test.clj @@ -110,7 +110,11 @@ (let [times-called (atom 0) foo #(swap! times-called inc)] (html [:div (foo)]) - (is (= @times-called 1))))) + (is (= @times-called 1)))) + (testing "defer evaluation of non-literal class names when combined with tag classes" + (let [class-local-var "class-foo class-bar"] + (is (= (html [:div.test {:class class-local-var}]) + "
"))))) (deftest render-modes (testing "closed tag"