[common] extend htmlEncode function

This commit is contained in:
Maxim Kadushkin 2021-05-06 16:29:27 +03:00
parent c14408bd9c
commit c8c5810d1c

View file

@ -587,8 +587,8 @@ Common.Utils.String = new (function() {
},
htmlEncode: function(string) {
//return _.escape(string);
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
return !!_ ? _.escape(string) :
string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
},
htmlDecode: function(string) {