Here you can find the source of escapeHTML()
var __entityMap = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/' }; String.prototype.escapeHTML = function() { return String(this).replace(/[&<>"'\/]/g, function(s) { return __entityMap[s]; });// w w w .j av a 2s . c o m } String.prototype.unescapeHTML = function() { return String(this).replace("&", "&").replace("<", "<").replace(">", ">").replace('"', '"').replace(''', "'").replace('/', "/"); } String.prototype.nl2br = function() { return String(this).replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br />$2'); } String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); } Number.prototype.pad = function(size) { var s = String(this); if (typeof(size) !== "number") { size = 2; } while (s.length < size) { s = "0" + s; } return s; }
String.prototype.escapeHTML = function() { return this. replace(/&/g, "&"). replace(/</g, "<"). replace(/>/g, ">"). replace(/\"/g, """); }; console.log("<&>".escapeHTML());
String.prototype.escapeHTML = function(){ var str = this.replace(/</g, '<'); return str.replace(/>/g, '>'); };
String.prototype.escapeHTML = function() var m = {"&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/'}; return String(this).replace(/[&<>"'\/]/g, function(s) return m[s]; });
String.prototype.escapeHTML = function () { return(this.replace(/&/g,'&').replace(/>/g,'>').replace(/</g,'<').replace(/"/g,'"')); };
String.prototype.escapeHTML = function() { return this.replace(/</g,'<').replace(/>/g, '>'); };
String.prototype.escapeHTML = function() { return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); };
var __entityMap = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/' }; String.prototype.escapeHTML = function() { ...
String.prototype.escapeHTML = function () { return ('' + this).replace(/&/g, '&').replace(/</g, '<').replace(/"/g, '"'); };