Closed arvgta closed 7 years ago
Am re-opening this, because I would like to know if this current logic is acceptable (I am very unsure about this issue):
if(link.href.substr(-1) ==='#') return true; // If standalone hash, enable default behaviour and return ??
Pronto, which I use as a backbone, does it this way, too. However, there may be a better way to handle this path of execution?
Questions:
1) Does the current logic cause discontinuation of Ajaxify's execution? 2) If so, how can Ajaxify be "kept alive" instead, emulating the behaviour that the user desired?
EDIT: Researched the web and it looks like a change in the hash part only does not cause a page refresh - also applying to a standalone hash
Therefore closing again
Hi Nicolas,
as we don't know the exact code yet for this special case, I have opened an issue instead of a pull request.
I understand, that the special case of a standalone hash was not being treated to your satisfaction. There are probably lots of CMS that work with standalone hashes, so this issue is important for a great deal of users...
Have read what you specified in #102 and do agree principally, but would like to tweak the exisiting logic for handling URLs with hashes with as litte as possible changes.
I see two possiblities (both within the
_click()
handler):1) Tweak the existing
_hashChange()
to be less / more selective (that would be the most elegant solution, if it does the job)or
2) Make a special branch / condition for handling standalone hashes, maybe introducing another option to enable / disable the new logic?
...finally, the solution must also leave the handling of hashes the same for internal links to different root URLs.
Also, returning
true
means, that the defaultclick()
kicks in and the event bubbles up, breaking the execution of Ajaxify, right? I would like to avoid that, if possible...Here's the current code of the
_click()
handler: