changeset 2189:43393a4a66ce

JavaScript versions of a few more functions
author Adam Chlipala <adam@chlipala.net>
date Sun, 01 Nov 2015 14:17:09 -0500 (2015-11-01)
parents 61866c765485
children 22117edf8fd3
files lib/js/urweb.js src/settings.sml
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Sun Nov 01 12:23:44 2015 -0500
+++ b/lib/js/urweb.js	Sun Nov 01 14:17:09 2015 -0500
@@ -1475,6 +1475,14 @@
     return ((str1 == str2) ? 0 : ((str1 > str2) ? 1 : -1));
 }
 
+function chr(n) {
+    return String.fromCharCode(n);
+}
+
+function htmlifySpecialChar(ch) {
+    return "&#" + ch.charCodeAt(0) + ";";
+}
+
 
 // Remote calls
 
--- a/src/settings.sml	Sun Nov 01 12:23:44 2015 -0500
+++ b/src/settings.sml	Sun Nov 01 14:17:09 2015 -0500
@@ -376,7 +376,10 @@
                           ("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)