1var sanitizeHTML = function (str) {
2 var temp = document.createElement('div');
3 temp.textContent = str;
4 return temp.innerHTML;
5};
1function htmlEntities(str) {
2 return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
3}