Handling unsafe HTML in SpiderGraph.js

This commit is contained in:
Marina Samuel 2015-02-05 09:56:40 -05:00
Родитель b40f73924c
Коммит 95fef3edbe
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -278,21 +278,21 @@ SpiderGraph.prototype = {
let minDate = d3.time.format('%m/%d/%Y')(new Date(daysPostEpochToDate(node.minDay)));
return '<div class="centerNode">' +
'<p id="totalInterests">' + node.numInterests + '</p>' +
'<p id="totalInterests">' + html_sanitize(node.numInterests) + '</p>' +
'<p id="activeInterestsLabel">Active Interests</p>' +
'<p id="startDate">since ' + minDate + '</p>' +
'<p id="startDate">since ' + html_sanitize(minDate) + '</p>' +
'</div>';
}
if (type != "hover") {
return '<p class="nodeText">' + node.name + '</p>';
return '<p class="nodeText">' + html_sanitize(node.name) + '</p>';
}
// Type is hover
if (!node.name) {
return "";
}
return '<p class="nodeText">(' + node.recommendationCount + ')<br>' + node.name + '</p>';
return '<p class="nodeText">(' + html_sanitize(node.recommendationCount) + ')<br>' + html_sanitize(node.name) + '</p>';
},
_getFontSizeByRadius: function(radius) {