Here you can find the source of htmlEscape()
/*//from w w w . j a va2s .com TaskDimension - lightweight project management tool Copyright (c) 2015 George Maizel <gmaizel@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>. */ "use strict"; String.prototype.htmlEscape = function() { return this. replace(/&/g, '&'). replace(/</g, '<'). replace(/>/g, '>'). replace(/"/g, '"'). replace(/\n/g, '<br/>'); }
String.prototype.htmlEscape = function () { return this.replace(/&/g, '%amp;') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, '''); console.log('<script>'.htmlEscape());
String.prototype.htmlEscape = function() { return $('<div/>').text(this.toString()).html(); }; (function($) { $.fn.hasScrollBar = function() { if (this.height() < 0) { return false; return this.get(0).scrollHeight > this.height(); ...
String.prototype.htmlEscape = function (){ var escapedStr = String(this).replace(/&/g, '&'); escapedStr = escapedStr.replace(/\s/g, ' '); return escapedStr; var text = 'This is for testing'; console.log(text); text = text.htmlEscape(); console.log(text); ...
String.prototype.htmlEscape = function (){ var escapedStr = String(this).replace(/&/g, '&'); escapedStr = escapedStr.replace(/</g, '<'); escapedStr = escapedStr.replace(/>/g, '>'); escapedStr = escapedStr.replace(/"/g, '"'); escapedStr = escapedStr.replace(/'/g, "'"); return escapedStr;
String.prototype.htmlEscape = function() { return this.replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, '''); console.log('<script>'.htmlEscape());
String.prototype.htmlEscape = function() { var obj = document.createElement('div'); if (typeof obj.textContent != 'undefined') { obj.textContent = this; } else { obj.innerText = this; return obj.innerHTML; }; ...
String.prototype.htmlEscape = function () { return this.replace(/"/g, '"').replace(/>/g, '>').replace(/</g, '<').replace(/&/g, '&'); };
String.prototype.normalizeHtml = function () { return this.replace(/(\n|\r|\t|\s\s+)/gm, "").trim(); };