diff options
| author | Asko Nõmm <asko@nmm.ee> | 2025-10-20 00:42:50 +0300 |
|---|---|---|
| committer | Asko Nõmm <asko@nmm.ee> | 2025-10-20 00:42:50 +0300 |
| commit | 7644be5e3beff7ee986aa77dc47e27aac0f22e1f (patch) | |
| tree | bd2bd06e2266fa98a0284042ba32ce3c30b6114f /src/dompa | |
| parent | 94a3ce3611522bb5112da85563c34f39c1da75c4 (diff) | |
#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.
Diffstat (limited to 'src/dompa')
| -rw-r--r-- | src/dompa/coordinates.cljc | 11 |
1 files changed, 4 insertions, 7 deletions
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`." |
