 
 (defn ^:export init
   []
-  (when-let [rootdom (. js/document (getElementById "golden-kestrel"))]
+  (when-let [rootdom (gdom/getElement "golden-kestrel")]
     (let [form-element (find-or-create-element rootdom "embed-form")
           embed-element (find-or-create-element rootdom "embed-example")
           code-element (find-or-create-element rootdom "embed-code")]

  (:require
    [clojure.string :as string]
    [clojure.set :as set]
    [om.core :as om :include-macros true]
    [om.dom :as dom :include-macros true]))



(defn find-or-create-element
  [root class-name]
  (let [possibles (gdom/getElementsByClass class-name root)]
    (if (= 0 (.-length possibles))
      (let [form-elem (gdom/createElement "div")]
        (set! (.-className form-elem) class-name)
        (gdom/appendChild root form-elem)
        form-elem)
      (aget possibles 0))))

