   )
 
 (defn -instrument [sub-component cursor m]
-  {:sub-component sub-component
-   :cursor cursor
-   :m m}
+  (dom/div #js {:data-huh-sub-component sub-component
+                :data-huh-cursor (.stringify js/JSON cursor)
+                :data-huh-m (.stringify js/JSON m)})
+  )
+
+(defn decode-sub-component [sub-component]
+  {:sub-component (js/eval (str "("
+                                (.getAttribute sub-component
+                                               "data-huh-sub-component")
+                                ")"))
+   :cursor (.parse js/JSON (.getAttribute sub-component "data-huh-cursor"))
+   :m (.parse js/JSON (.getAttribute sub-component "data-huh-m"))}
   )
 
 (defn test-predicates


(defn containing [& tests]
  (fn -containing-pred [component]
    (let [children (.. component -props -children)
          test-count (count tests)]
      (if (= (type children) js/Array)
        ;; React annoyingly makes children = the single child element,
        ;; when there is only one, instead of a list of one
        (let [child-count (count children)]
          (if (not= test-count child-count)
            {:msg "Wrong number of child elements"
             :expected test-count :actual child-count
             :actual-children (display-children children)}
            (if-let [failures
                     (seq (filter (fn [result] (not= true result))
                                  (map (fn [pred child] (pred child))
                                       tests children
                                       )))]
              failures
              true
              )
            )
          )
        (if (not= 1 test-count) ;; Children is actually just one child
          {:msg "Wrong number of child elements"
           :expected test-count :actual 1
           :actual-children (display-children children)}
          ((nth tests 0) children)
          )
        )
      )
    )
  )

(defn nothing [component]
  (if (nil? component)
    true
    {:msg "non empty container" :expected nil :actual component}
    )
  )

(defn text [text]
  (fn -text-pred [component]
    (if (= text component)
      true
      {:msg "Text does not match" :expected text :actual component}
      )
    )
  )

(defn display-child
  ([component]
     (cond
      (not (nil? (.-tagName component)))
      {
       :tag (.-tagName component)
       :children (display-children (g-array/toArray (.. component -children)))
       }
      (fn? component) {:sub-component (component-name component)}
      (string? component) {:text component}
