JS: implement Icinga.Utils.escape()
This commit is contained in:
parent
4cd2469a5f
commit
a493c3469c
|
@ -371,6 +371,21 @@
|
|||
return encodeURIComponent(str).replace(/[()]/g, function(c) {
|
||||
return '%' + c.charCodeAt(0).toString(16);
|
||||
});
|
||||
},
|
||||
|
||||
escape: function (str) {
|
||||
return String(str).replace(
|
||||
/[&<>"']/gm,
|
||||
function (c) {
|
||||
return {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
}[c];
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue