-
-
Notifications
You must be signed in to change notification settings - Fork 608
Closed
Labels
Milestone
Description
Please consider using of innerText for <span> tag when constructing node's title to prevent HTML injection. For now if I have title of my node looking something like this: <hi>
then I will not see this title in the browser. It will be interpreted as html-tag.
The possible solution is to change line 2804
nodeTitle = "<span " + role + " class='fancytree-title'" + id + tooltip + tabindex + ">" + node.title + "</span>";to something like this:
var span = document.createElement('span');
span.className = 'fancytree-title';
if (aria) {
span.setAttribute('role', 'treeitem');
span.setAttribute('id', 'ftal_' + node.key);
}
if (node.tooltip) {
span.setAttribute('title', node.tooltip.replace(/\"/g, """));
}
span.innerText = node.title;
nodeTitle = span.outerHTML;