Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade versions #84

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ pom.xml
*.*~
\#*#
.#*
.DS_store
.DS_store
*.iml
5 changes: 3 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(defproject domina "1.0.4-SNAPSHOT"
:description "A DOM manipulation library for ClojureScript inspired by JQuery"
:source-paths ["src/cljs"]
:dependencies [[org.clojure/clojure "1.4.0"]]
:plugins [[lein-cljsbuild "0.3.0"]
:dependencies [[org.clojure/clojure "1.10.1"]
[org.clojure/clojurescript "1.10.597"]]
:plugins [[lein-cljsbuild "1.1.7"]
[lein-clojars "0.9.1"]]
:hooks [leiningen.cljsbuild]
:cljsbuild {:builds [{:jar true
Expand Down
6 changes: 3 additions & 3 deletions src/cljs/domina.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

;;;;;;;;;;;;;;;;;;; Public API ;;;;;;;;;;;;;;;;;

(def *debug* true)
(def ^:dynamic *debug* true)
(defn log-debug [& mesg]
(when (and *debug* (not (= (.-console js/window) js/undefined)))
(.log js/console (apply str mesg))))
Expand Down Expand Up @@ -191,12 +191,12 @@
(defn detach!
"Removes all the nodes in a content from the DOM and returns them."
[content]
(doall (map dom/removeNode (nodes content))))
(doall (map dom/removeNode (vec (nodes content)))))

(defn destroy!
"Removes all the nodes in a content from the DOM. Returns nil."
[content]
(dorun (map dom/removeNode (nodes content))))
(dorun (map dom/removeNode (vec (nodes content)))))

(defn destroy-children!
"Removes all the child nodes in a content from the DOM. Returns the original content."
Expand Down
4 changes: 2 additions & 2 deletions src/cljs/domina/css.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"Returns content based on a css selector expression. Takes an optional content as a base; if none is given, uses the HTML element as a base."
([expr] (sel (root-element) expr))
([base expr] (reify domina/DomContent
(nodes [_] (mapcat #(domina/normalize-seq (dom/query expr %))
(nodes [_] (mapcat #(domina/normalize-seq (.querySelectorAll % expr))
(domina/nodes base)))
(single-node [_] (first (filter
(complement nil?)
(mapcat #(domina/normalize-seq (dom/query expr %))
(mapcat #(domina/normalize-seq (.querySelector % expr))
(domina/nodes base))))))))
2 changes: 1 addition & 1 deletion test/cljs/domina/test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[domina.xpath :only [xpath]]
[domina.css :only [sel]]
[domina.events :only [listen! capture! listen-once! capture-once!
unlisten! dispatch-event! dispatch! unlisten-by-key!
unlisten! dispatch! unlisten-by-key!
get-listeners prevent-default stop-propagation
target current-target event-type raw-event]])
(:require [goog.events :as events]
Expand Down