From 7a8662edea56c986048070ab8a552e8cfabd1037 Mon Sep 17 00:00:00 2001 From: Daniel Compton Date: Thu, 16 Nov 2017 13:49:52 +1300 Subject: [PATCH] Refactor naming to match JSONML spec --- src/day8/re_frame/trace/panels/app_db.cljs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/day8/re_frame/trace/panels/app_db.cljs b/src/day8/re_frame/trace/panels/app_db.cljs index b6830f8..e2c6772 100644 --- a/src/day8/re_frame/trace/panels/app_db.cljs +++ b/src/day8/re_frame/trace/panels/app_db.cljs @@ -90,17 +90,17 @@ [jsonml] (if (number? jsonml) jsonml - (let [[head & args] jsonml + (let [[tag-name attributes & children] jsonml tagnames #{"div" "span" "ol" "li" "table" "tr" "td"}] (cond - (contains? tagnames head) (let [[style & children] args] - (into - [(keyword head) {:style (-> (js->clj style) - (get "style") - (string->css))}] - (map jsonml->hiccup children))) + (contains? tagnames tag-name) (into + [(keyword tag-name) {:style (-> (js->clj attributes) + (get "style") + (string->css))}] + (map jsonml->hiccup) + children) - (= head "object") [data-structure jsonml] + (= tag-name "object") [data-structure jsonml] :else jsonml)))) (defn subtree [data title]