mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
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 encodeURIComponent(str).replace(/[()]/g, function(c) {
|
||||||
return '%' + c.charCodeAt(0).toString(16);
|
return '%' + c.charCodeAt(0).toString(16);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
escape: function (str) {
|
||||||
|
return String(str).replace(
|
||||||
|
/[&<>"']/gm,
|
||||||
|
function (c) {
|
||||||
|
return {
|
||||||
|
'&': '&',
|
||||||
|
'<': '<',
|
||||||
|
'>': '>',
|
||||||
|
'"': '"',
|
||||||
|
"'": '''
|
||||||
|
}[c];
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user