Here you can find the source of escape()
String.prototype.escape = function () { var tagsToReplace = { '&': '&', '<': '<', '>': '>', };//from www .j ava 2s. co m return this.replace(/[&<>]/g, function (tag) { return tagsToReplace[tag] || tag; }); }; function jsObj2phpObj(object) { var json = "{"; for (property in object) { var value = object[property]; if (typeof (value) == "string") { json += '"' + property + '":"' + value + '",' } else { if (!value[0]) { json += '"' + property + '":' + value + ','; } else { json += '"' + property + '":['; for (prop in value) json += '"' + value[prop] + '",'; json = json.substr(0, json.length - 1) + "],"; } } } return json.substr(0, json.length - 1) + "}"; }
String.prototype.escape = function () { var entityMap = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''' }; return this.replace(/[&<>"']/g, function (s) { ...
String.prototype.escape = function() { var tagsToReplace = { '&': '&', '<': '<', '>': '>' }; return this.replace(/[&<>]/g, function(tag) { return tagsToReplace[tag] || tag; }); ...
String.prototype.escape = function () { var tagsToReplace = { '&': '&', '<': '<', '>': '>' }; return this.replace(/[&<>]/g, function (tag) { return tagsToReplace[tag] || tag; }); ...
String.prototype.escape = function () { var entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/' }; ...
String.prototype.escape = function() { return this .replace(/&(?!\w+;)/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"'); };
String.prototype.escape = function() { var tagsToReplace = { '&': '&', '<': '<', '>': '>' }; return nl2br(this.replace(/[&<>]/g, function(tag) { return tagsToReplace[tag] || tag; })); ...
String.prototype.escape = function() { return escape(this.replace(/\s/g, '-'));
String.prototype.escapeSpecialChars = function() { return this.replace(/\\n/g, "\\n") .replace(/\\'/g, "\\'") .replace(/\\"/g, '\\"') .replace(/\\&/g, "\\&") .replace(/\\r/g, "\\r") .replace(/\\t/g, "\\t") .replace(/\\b/g, "\\b") .replace(/\\f/g, "\\f"); ...
String.prototype.escapeSpecialChars = function () { return this.replace(/\\n/g, '\\\\n') .replace(/\\'/g, '\\\'') .replace(/\\'/g, '\\\'') .replace(/\\&/g, '\\\&') .replace(/\\r/g, '\\\r') .replace(/\\t/g, '\\\\t') .replace(/\\b/g, '\\\b') .replace(/\\f/g, '\\\f'); ...