Here you can find the source of escapeHTML()
/**/* w w w. j ava 2 s . c o m*/ @Name: String.prototype.escapeHTML @Author: Paul Visco @Version: 1.0 11/19/07 @Description: Checks to see if a string is empty or not @Return: Escapes < and > @Example: var str = '<p>hello</p>'; var newString = str.escapeHTML(); //newString = '<p>hello</p>' */ String.prototype.escapeHTML = function(){ var str = this.replace(/</g, '<'); return str.replace(/>/g, '>'); };
String.prototype.escapeHTML = function() { return this. replace(/&/g, "&"). replace(/</g, "<"). replace(/>/g, ">"). replace(/\"/g, """); }; console.log("<&>".escapeHTML());
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,'"')); };
var __entityMap = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/' }; String.prototype.escapeHTML = function() { ...
String.prototype.escapeHTML = function() { return this.replace(/</g,'<').replace(/>/g, '>'); };