(defn children
"Normalize the children of a HTML element."
[x]
(->> (cond
(nil? x)
'()
(string? x)
(list x)
(util/element? x)
(list x)
(and (list? x) (symbol? (first x)))
(list x)
(list? x)
x
(and (sequential? x)
(= (count x) 1)
(sequential? (first x))
(not (string? (first x)))
(not (util/element? (first x))))
(children (first x))
(sequential? x)
x
:else (list x))
(remove nil?)))