summaryrefslogtreecommitdiff
path: root/public/js/render.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--public/js/render.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/public/js/render.js b/public/js/render.js
new file mode 100644
index 00000000..1abb68c5
--- /dev/null
+++ b/public/js/render.js
@@ -0,0 +1,13 @@
+function preventXSS(html) {
+ var options = {
+ allowCommentTag: true,
+ onIgnoreTagAttr: function (tag, name, value, isWhiteAttr) {
+ // allow attr start with 'data-' or equal 'id' and 'class'
+ if (name.substr(0, 5) === 'data-' || name === 'id' || name === 'class') {
+ // escape its value using built-in escapeAttrValue function
+ return name + '="' + filterXSS.escapeAttrValue(value) + '"';
+ }
+ }
+ };
+ return filterXSS(html, options);
+} \ No newline at end of file