 (defn log-obj [obj]
   (.log js/console obj))
 
-(declare element)
 (extend-protocol DOMBuilder
 
   string
   (-element
     ([this]
        (log "string (-element " this ")")
-       (cond (keyword? this) (dom/createElement  (name this))
-             :else           (dom/createTextNode (name s))))
+       (cond (keyword? this) (gdom/createElement  (name this))
+             :else           (gdom/createTextNode (name this))))
 
     ([this attrs-or-children]
        (log "string (-element " this " " attrs-or-children ")")

(defn remove-children
  "Remove all children from the element with the passed id."
  [id]
  (let [parent (dom/getElement (name id))]
    (do (dom/removeChildren parent))))

(defn get-element [id]
  (dom/getElement (name id)))

(defn html [s]
  (dom/htmlToDocumentFragment s))

(defn element-arg? [x]
  (or (keyword? x)
      (map? x)
      (string? x)))

(defn insert-at [parent child index]
  (dom/insertChildAt parent child index))

(ns clojure.browser.dom
  (:require [goog.dom :as gdom]))

(defn append [parent & children]
  (apply gdom/append parent children)
  parent)

(defprotocol DOMBuilder
