From 7644be5e3beff7ee986aa77dc47e27aac0f22e1f Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Mon, 20 Oct 2025 00:42:50 +0300 Subject: #7: Fixes an issue where `!doctype` would be left out when creating nodes due to it being a void element, and adds a full HTML page test case. --- src/dompa/coordinates.cljc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/dompa/coordinates.cljc') diff --git a/src/dompa/coordinates.cljc b/src/dompa/coordinates.cljc index 2388fcd..dbb4e0e 100644 --- a/src/dompa/coordinates.cljc +++ b/src/dompa/coordinates.cljc @@ -117,7 +117,7 @@ {:coord-type :text, :coord-name :dompa/text}))) (def ^:private void-elements - #{"area" "base" "br" "col" "embed" "hr" "img" + #{"!DOCTYPE" "!doctype" "area" "base" "br" "col" "embed" "hr" "img" "input" "link" "meta" "param" "source" "track" "wbr"}) (defn- handle-opening-tag [{:keys [stack unified coord coord-name start]}] @@ -201,9 +201,7 @@ "Parses a given HTML node attribute string into a key-value pair." [attr] - (->> (partition-by #(= % \=) attr) - (filter #(not= (-> % first) \=)) - (map #(reduce str %)))) + (str/split attr #"=" 2)) (defn- normalize-html-attr-str "Normalizes a given HTML attribute string. If it @@ -221,9 +219,8 @@ treated as boolean attributes, and are always `true`." [html-attr-str] (let [[k v] (html-attr-str->k-v html-attr-str) - k (keyword k) - v (if (nil? v) true (normalize-html-attr-str v))] - {k v})) + k (keyword k)] + {k (if (nil? v) true (normalize-html-attr-str v))})) (defn- html->str->node-attrs-reducer-fn "Returns a reducer function with initial state of `attrs-html`." -- cgit v1.2.3