mar10 / dynatree

Automatically exported from code.google.com/p/dynatree
92 stars 37 forks source link

Dynatree 'steals' clicks on anchors inside the node title #500

Closed slahn closed 8 years ago

slahn commented 8 years ago

I have a tree set up with noLink: true, and each node contains a bit of information, including a hyperlink. Clicking this hyperlink doesn't do anything, though - the click is 'stolen' by Dynatree.

In _onClick:

this._userActivate();
var aTag = this.span.getElementsByTagName("a");
if (aTag[0]) {
    // issue 154, 313
    if (!(BROWSER.msie && parseInt(BROWSER.version, 10) < 9)) {
        aTag[0].focus();
    }
} else {
    // 'noLink' option was set
    return true;
}

I suspect what you're trying to do, is cancel the click if noLinkis true, that is, check if the title is a span or an anchor? In that case, wouldn't it be better to do var aTag = $(this.span).children("a.dynatree-title"); rather than var aTag = this.span.getElementsByTagName("a");? That seems to solve the problem for me, at least.

mar10 commented 8 years ago

Thanks for contributing. I applied your patch (without testing), so it will go into a next release (if there will be any)