diff --git a/project.clj b/project.clj index 351c9e3..ca99db7 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject kibu/pushy "0.3.1" +(defproject kibu/pushy "0.3.2" :description "HTML5 pushState for Clojurescript" :url "https://github.com/kibu-australia/pushy" :license {:name "Eclipse Public License" diff --git a/src/pushy/core.cljs b/src/pushy/core.cljs index 112a05b..8b91dee 100644 --- a/src/pushy/core.cljs +++ b/src/pushy/core.cljs @@ -90,12 +90,15 @@ (on-click (fn [e] (when-let [el (recur-href (-> e .-target))] - (let [href (.-href el) - path (->> href (.parse Uri) .getPath)] + (let [uri (.parse Uri (.-href el)) + path (.getPath uri) + query (.getQuery uri) + ;; Include query string in token + next-token (if (empty? query) path (str path "?" query))] ;; Proceed if `identity-fn` returns a value and ;; the user did not trigger the event via one of the ;; keys we should bypass - (when (and (identity-fn (match-fn path)) + (when (and (identity-fn (match-fn next-token)) ;; Bypass dispatch if any of these keys (not (.-altKey e)) (not (.-ctrlKey e)) @@ -107,8 +110,8 @@ (not= 1 (.-button e))) ;; Dispatch! (if-let [title (-> el .-title)] - (set-token! this path title) - (set-token! this path)) + (set-token! this next-token title) + (set-token! this next-token)) (.preventDefault e))))))) nil)