bide icon indicating copy to clipboard operation
bide copied to clipboard

Support for anchor tag - currently pollutes results

Open ibothwell opened this issue 8 years ago • 3 comments

Love the library. Very simple to use. Did run into issues with anchors. if they are on the path then they leak into the produced results.

(def routes [["/" :root] ["/:id" :root-with-id]]) (def my-router (r/router routes)) (r/match my-router "/") ; [:root nil nil] (r/match my-router "/?a=1") ; [:root nil {:a "1"}] (r/match my-router "/?a=1#asdf") ; [:root nil {:a "1#asdf"}] (r/match my-router "/#asdf") ; [:root-with-id {:id "#asdf"} nil] (r/match my-router "/my-id#asdf") ; [:root-with-id {:id "my-id#asdf"} nil] (r/match my-router "/my-id?a=1#asdf") ; [:root-with-id {:id "my-id"} {:a "1#asdf"}]

ibothwell avatar May 19 '17 16:05 ibothwell

A PR with a fix is welcome!

niwinz avatar May 28 '17 18:05 niwinz

I am also interested in this. I assume we don't want to completely discard the anchor tag. @niwinz Where should the parsed anchor tag go in the result from match?

kennyjwilli avatar Dec 18 '18 23:12 kennyjwilli

Also worth noting that the behavior I see is different than the behavior shown in this issue's description:

(r/match (r/router [["/page1" :page1]])
         "/page1")
=> [:page1 nil nil]
(r/match (r/router [["/page1" :page1]])
         "/page1#anchor")
=> nil

kennyjwilli avatar Dec 18 '18 23:12 kennyjwilli