Closed satazor closed 12 years ago
It would be nice to have these two functions because sometimes we do not want to strip tags but escape them instead.
function escapeHTML() { return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g, """); } function unescapeHTML() { return this.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/'/g,"'").replace(/"/g, '"'); }
A possible implementation just for reference.
It would be nice to have these two functions because sometimes we do not want to strip tags but escape them instead.
A possible implementation just for reference.