Skip to content

Instantly share code, notes, and snippets.

@cpetzold
Created January 17, 2013 19:19
Show Gist options
  • Save cpetzold/4558763 to your computer and use it in GitHub Desktop.
Save cpetzold/4558763 to your computer and use it in GitHub Desktop.
(defn selector [data]
(cond
(or (string? data) (keyword? data)) (name data)
(coll? data) (clojure.string/join " " (map selector data))))
(defmacro sel
([data]
`(sel ~data js/document))
([data base]
`(.querySelector ~base ~(selector data))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment