try {
div.style[name] = messagestyle[name];
} catch (e) {
- Dygraph.warn("You are using unsupported css properties for your " +
+ console.warn("You are using unsupported css properties for your " +
"browser in labelsDivStyles");
}
}
return oneEmWidth;
};
+var escapeHTML = function(str) {
+ return str.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
+};
+
legend.prototype.select = function(e) {
var xValue = e.selectedX;
var points = e.selectedPoints;
strokePattern = g.getOption("strokePattern", labels[i]);
dash = generateLegendDashHTML(strokePattern, series.color, oneEmWidth);
html += "<span style='font-weight: bold; color: " + series.color + ";'>" +
- dash + " " + labels[i] + "</span>";
+ dash + " " + escapeHTML(labels[i]) + "</span>";
}
return html;
}
// TODO(danvk): use a template string here and make it an attribute.
html += "<span" + cls + ">" + " <b><span style='color: " + series.color + ";'>" +
- pt.name + "</span></b>: " + yval + "</span>";
+ escapeHTML(pt.name) + "</span></b>: " + yval + "</span>";
}
return html;
};