According to issue #177 we need only tags to be escaped, but not other special characters, not to be escaped twice

This commit is contained in:
Zalmoxisus 2014-10-20 16:37:30 +04:00
parent ae7429fb28
commit c3fbb1fcbc
1 changed files with 7 additions and 0 deletions

View File

@ -44,6 +44,13 @@ var Util = (function (my) {
* Escapes the given text.
*/
my.escapeHtml = function (unsafeText) {
return $('<div/>').text(unsafeText).html();
};
/**
* Escapes only tags from the given text.
*/
my.escapeTags = function (unsafeText) {
return unsafeText.replace(/</g, '&lt;').replace(/>/g, '&gt;');
};