Skip to content

Commit

Permalink
Merge pull request #471 from afilippov1985/fix/inline-javascript
Browse files Browse the repository at this point in the history
Add onclick handler only if it's not empty
  • Loading branch information
zTree authored Nov 21, 2020
2 parents 60796de + 11618d5 commit ddbe178
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/jquery.ztree.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,9 @@
}
html.push("<a id='", node.tId, consts.id.A, "' class='", consts.className.LEVEL, node.level,
nodeClasses.add ? ' ' + nodeClasses.add.join(' ') : '',
"' treeNode", consts.id.A, " onclick=\"", (node.click || ''),
"\" ", ((url != null && url.length > 0) ? "href='" + url + "'" : ""), " target='", view.makeNodeTarget(node), "' style='", fontStyle.join(''),
"' treeNode", consts.id.A,
node.click ? " onclick=\"" + node.click + "\"" : "",
((url != null && url.length > 0) ? " href='" + url + "'" : ""), " target='", view.makeNodeTarget(node), "' style='", fontStyle.join(''),
"'");
if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) {
html.push("title='", title.replace(/'/g, "&#39;").replace(/</g, '&lt;').replace(/>/g, '&gt;'), "'");
Expand Down Expand Up @@ -2015,4 +2016,4 @@
var zt = $.fn.zTree,
$$ = tools.$,
consts = zt.consts;
})(jQuery);
})(jQuery);

0 comments on commit ddbe178

Please sign in to comment.