Add htmlescape() helper function

Thu, 18 Mar 2010 18:35:35 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 18 Mar 2010 18:35:35 +0000
changeset 27
8ca116c827cf
parent 26
662fcb6922ab
child 28
85fb6653b6e0

Add htmlescape() helper function

js/supportchat.js file | annotate | diff | comparison | revisions
--- a/js/supportchat.js	Thu Mar 18 18:35:19 2010 +0000
+++ b/js/supportchat.js	Thu Mar 18 18:35:35 2010 +0000
@@ -122,4 +122,13 @@
 	}
 }
 
+/*** Helper functions */
+function htmlescape(s)
+{
+	return s.replace(/&/g,'&amp;').
+		replace(/>/g,'&gt;').
+		replace(/</g,'&lt;').
+		replace(/"/g,'&quot;');
+}
+
 $(display_ui); //FIXME (debugging)

mercurial