summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dompa/coordinates.cljc2
-rw-r--r--test/dompa/coordinates_test.cljc8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/dompa/coordinates.cljc b/src/dompa/coordinates.cljc
index bba8b5c..ebe9b65 100644
--- a/src/dompa/coordinates.cljc
+++ b/src/dompa/coordinates.cljc
@@ -270,7 +270,7 @@
(partition-by #(= % \space))
(drop 1)
flatten
- (reduce str)
+ (apply str)
str/trim))
(defn- html-str->node-attrs
diff --git a/test/dompa/coordinates_test.cljc b/test/dompa/coordinates_test.cljc
index 85a4518..79248e3 100644
--- a/test/dompa/coordinates_test.cljc
+++ b/test/dompa/coordinates_test.cljc
@@ -107,6 +107,14 @@
coordinates/compose
coordinates/unify
coordinates/->nodes))))
+
+ (testing "Create nodes from self-closing tags"
+ (is (= [{:node/name :hr
+ :node/attrs {}}]
+ (-> "<hr />"
+ coordinates/compose
+ coordinates/unify
+ coordinates/->nodes))))
(testing "Create nodes with attributes"
(is (= [{:node/name :div