   New DOM nodes to insert."
   [root-node rules new-nodes]
   (or
-    (->>
-      (map (fn [[path position]]
-        (extend-root-element root-node path position new-nodes)) rules)
-      (remove nil?)
-      first)
-    root-node))
+   (->>
+    (map (fn [[path position]]
+           (extend-root-element root-node path position new-nodes)) rules)
+    (remove nil?)
+    first)
+   root-node))
 
 (defn extend-dom
   "Extends a DOM (a set of root DOM nodes), adding new nodes at a specific position. Uses the path

Does nothing if the targetted node can't be found. Returns a new
sequence of dom nodes.
dom-nodes
  A seq of nodes representing the document. The first element node is considered the root.
rules
  A seq of rules identifying where to place the new nodes. Each rule is a pair of values.
  The first value is a seq of element types (as keywords) to navigate down. The second
  value is a position (:before, :after:, :top, or :bottom). The first matching rule
  is used.
new-nodes
  The new nodes to insert in a position within the document."
  [dom-nodes rules new-nodes]
  (loop [result []
         queue dom-nodes]

;;; and limitations under the License.

(ns
    cascade.dom
  "DOM node structure, rendering and manipulation"
  (:import
   (clojure.lang Keyword Sequential))
  (:require
   (clojure [zip :as z] [string :as str]))
  (:use
   (cascade fail utils)))

;;; TODO: For testing purposes (i.e., to get consistent results across JVMs, etc.)
;;; it may be necessary to sort attributes when rendering (but I'd rather not bother
