diff --git a/src/cljs-lib/src/calva/html2hiccup.cljs b/src/cljs-lib/src/calva/html2hiccup.cljs index a2e175834..218149d75 100644 --- a/src/cljs-lib/src/calva/html2hiccup.cljs +++ b/src/cljs-lib/src/calva/html2hiccup.cljs @@ -37,7 +37,7 @@ (defn- mapify-style [style-str] (try - (into {} (for [[_ k v] (re-seq #"(\S+):\s*([^;]+);?" style-str)] + (into {} (for [[_ k v] (re-seq #"(\S+?)\s*:\s*([^;]+);?" style-str)] [(-> k string/lower-case keyword) (normalize-css-value v)])) (catch :default e (js/console.warn "Failed to mapify style: '" style-str "'." (.-message e)) diff --git a/src/cljs-lib/test/calva/html2hiccup_test.cljs b/src/cljs-lib/test/calva/html2hiccup_test.cljs index 045b5ca1d..26ab765f8 100644 --- a/src/cljs-lib/test/calva/html2hiccup_test.cljs +++ b/src/cljs-lib/test/calva/html2hiccup_test.cljs @@ -101,7 +101,10 @@ (sut/html->hiccup "" {:mapify-style? false})))) (testing "style attributes do not need whitespace between entries with mapify-style? enabled" (is (= [[:foo {:style {:color :blue}}]] - (sut/html->hiccup "" {:mapify-style? true}))))) + (sut/html->hiccup "" {:mapify-style? true}))) + (is (= [[:foo {:style {:color :blue + :stroke :red}}]] + (sut/html->hiccup "" {:mapify-style? true}))))) (deftest html->hiccup-w-mapify-style? (testing "style attribute is mapified with :mapify-style? enabled"