aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/js/urweb.js8
-rw-r--r--src/settings.sml5
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 45ed6be8..6cf8a3f3 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -1475,6 +1475,14 @@ function strcmp(str1, str2) {
return ((str1 == str2) ? 0 : ((str1 > str2) ? 1 : -1));
}
+function chr(n) {
+ return String.fromCharCode(n);
+}
+
+function htmlifySpecialChar(ch) {
+ return "&#" + ch.charCodeAt(0) + ";";
+}
+
// Remote calls
diff --git a/src/settings.sml b/src/settings.sml
index 0140ddc0..b021b587 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -376,7 +376,10 @@ val jsFuncsBase = basisM [("alert", "alert"),
("atom", "atom"),
("css_url", "css_url"),
("property", "property"),
- ("giveFocus", "giveFocus")]
+ ("giveFocus", "giveFocus"),
+
+ ("htmlifySpecialChar", "htmlifySpecialChar"),
+ ("chr", "chr")]
val jsFuncs = ref jsFuncsBase
fun setJsFuncs ls = jsFuncs := foldl (fn ((k, v), m) => M.insert (m, k, v)) jsFuncsBase ls
fun jsFunc x = M.find (!jsFuncs, x)