Here you can find the source of encodeHTML()
/**/*from w w w . ja va 2s .co m*/ * Add HTML encode function to String. * * @returns {String} the HTML encoded string */ String.prototype.encodeHTML = function () { return this.replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"'); };
define(function() { String.prototype.encodeHTML=function () { var encodeHTMLRules, matchHTML; encodeHTMLRules = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', ...
String.prototype.encodeHTML = function() { var encodeHTMLRules = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/' }, matchHTML = /&(?!#?\w+;)|<|>|"|'|\ return function() { return this ? this.replace(matchHTML, function(m) {return encodeHTMLRules[m] || m;}) : this; }; }();
function encodeHTMLSource() { var encodeHTMLRules = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/'}, matchHTML = /&(?!#?\w+;)|<|>|"|'|\ return function() { return this ? this.replace(matchHTML, function(m) {return encodeHTMLRules[m] || m; }) : this; }; String.prototype.encodeHTML = encodeHTMLSource();
String.prototype.encodeHtml = function() { var encodedHtml = escape(this); encodedHtml = encodedHtml.replace(/\ encodedHtml = encodedHtml.replace(/\?/g,"%3F"); encodedHtml = encodedHtml.replace(/=/g,"%3D"); encodedHtml = encodedHtml.replace(/&/g,"%26"); encodedHtml = encodedHtml.replace(/@/g,"%40"); return encodedHtml;