 (defn create-elem [nsp tag]
   (.createElementNS js/document nsp (name tag)))
 
-(defn build-dom-elem [el]
+(defn build-dom-elem
+  "Build live DOM element from hiccup vector, hiccup map, or string."
+  [el]
   (match [el]
          [(s :when string?)] (gdom/createTextNode s)
          [(v :when vector?)] (recur (canonicalize v))

                                                                  {:id (or id nil)
                                                                   :class (if class (string/replace class #"\." " "))}))
                                   map-attrs        (first content)]
                               
                               (let [[attr raw-children] (if (map? map-attrs)
                                                                [(merge tag-attrs map-attrs) (next content)]
                                                                [tag-attrs content])
                                     ;;Explode children seqs in place
                                     children (mapcat #(if (and (not (vector? %)) (seq? %))
                                                         (map canonicalize %)

       (style el v)
       (.setAttribute el (name k) v))))

(defn text
  "Get or set element text."
  ([el]
     (gdom/getTextContent (select el)))
  ([el v]
     (gdom/setTextContent (select el) v)))

(defn classed!
  "Add or remove `class` to `el` based on boolean `classed?`."
  [el class classed?]
  (gclasses/enable (select el) class classed?))

