From c3fbb1fcbc8cabf2b514fd8d8b8541c43a3487ec Mon Sep 17 00:00:00 2001 From: Zalmoxisus Date: Mon, 20 Oct 2014 16:37:30 +0400 Subject: [PATCH] According to issue #177 we need only tags to be escaped, but not other special characters, not to be escaped twice --- util.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/util.js b/util.js index c54425444..daebfd914 100644 --- a/util.js +++ b/util.js @@ -44,6 +44,13 @@ var Util = (function (my) { * Escapes the given text. */ my.escapeHtml = function (unsafeText) { + return $('
').text(unsafeText).html(); + }; + + /** + * Escapes only tags from the given text. + */ + my.escapeTags = function (unsafeText) { return unsafeText.replace(//g, '>'); };