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

Href click event not propagation after click #244

Open
tn801534 opened this issue Feb 4, 2015 · 1 comment
Open

Href click event not propagation after click #244

tn801534 opened this issue Feb 4, 2015 · 1 comment

Comments

@tn801534
Copy link

tn801534 commented Feb 4, 2015

=>I think "return true;" if better so the click event can delegate to parents.

$(document).delegate('a', 'click.history-' + this.app.eventNamespace(), function (e) {
if (e.isDefaultPrevented() || e.metaKey || e.ctrlKey) {
return;
}
var full_path = lp.fullPath(this),
// Get anchor's host name in a cross browser compatible way.
// IE looses hostname property when setting href in JS
// with a relative URL, e.g. a.setAttribute('href',"/whatever").
// Circumvent this problem by creating a new link with given URL and
// querying that for a hostname.
hostname = this.hostname ? this.hostname : function (a) {
var l = document.createElement("a");
l.href = a.href;
return l.hostname;
}(this);

      if (hostname == window.location.hostname &&
          app.lookupRoute('get', full_path) &&
          Sammy.targetIsThisWindow(e, 'a')) {
        e.preventDefault();
        proxy.setLocation(full_path);
        return false;                                                      
      }
    });
@mdumouchel
Copy link

Is there a reason that it is set to false? I also agree it seems strange for it preventing a links from delegating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants