quirkey/sammy

Href click event not propagation after click

Opened this issue · 1 comments

=>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;                                                      
      }
    });

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