-
Notifications
You must be signed in to change notification settings - Fork 422
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
Don't treat links to "#" as "/" #285
Conversation
Breaks many places where "#" is placed as a dummy href and are handled through click events. It can be prevented with stopPropagation() but then it won't propagate to its parents. This fixes my case, but i'm not sure if it's desirable for others.
You should not have dummy links with #, javascript:// is better but still wrong. Prevent changing the hash with preventDefault() On Feb 17, 2013, at 12:55 PM, DVSoftware notifications@github.com wrote:
|
But it still catches them, unless i call stopPropagation(), which in my case breaks catching the outerclicks (i listen to clicks on body, to close modal windows etc), as it doesn't propagate further. I could change to "javascript://" but i kinda still think it's wrong to treat "#" as "/" route (at least with pushstate). |
What do you mean catches them? The route will change unless preventDefault is called, not stopPropagation. It's not wrong to respond to changing the hash to #. If the hash changes, can.route should respond to it, whatever it is. Otherwise back button and bookmarking won't work as expected. On Feb 17, 2013, at 1:18 PM, DVSoftware notifications@github.com wrote:
|
Well, the thing is, it does change even if preventDefault is called. At
|
This should do it, instead of checking for '#', i now changed it to check if default is prevented. |
THis looks good. |
Travis build seems to be stalled for some reason, going to the link says it's actually passed... |
Breaks many places where "#" is placed as a dummy href and are handled through click events. It can be prevented with stopPropagation() but then it won't propagate to its parents. This fixes my case, but i'm not sure if it's desirable for others.