aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-01-01 10:49:36 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-01-01 10:49:36 -0500
commit66ea568ab5cd2b187a305ef6d22c8cfaf2a6c629 (patch)
treea1c114af140aee012d6f75b186cb3c4fd4e9d9d4
parent76a84dd3fb97b56605292c4f0eab2febe3c6a7ed (diff)
Proper client-side attrifyString
-rw-r--r--lib/js/urweb.js4
-rw-r--r--src/settings.sml2
-rw-r--r--tests/sendurl.ur11
-rw-r--r--tests/sendurl.urp4
-rw-r--r--tests/sendurl.urs1
5 files changed, 21 insertions, 1 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 3a0e7f9f..8d7f6e40 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -603,6 +603,10 @@ function uu(s) {
return decodeURIComponent(s.replace(new RegExp ("\\+", "g"), " "));
}
+function atr(s) {
+ return s.replace(new RegExp ("\"", "g"), "&quot;").replace(new RegExp ("&", "g"), "&amp;")
+}
+
function ub(b) {
return b ? "1" : "0";
}
diff --git a/src/settings.sml b/src/settings.sml
index b95ce1ea..03b7fd6d 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -158,7 +158,7 @@ val jsFuncsBase = basisM [("alert", "alert"),
("onConnectFail", "onConnectFail"),
("onDisconnect", "onDisconnect"),
("onServerError", "onServerError"),
- ("attrifyString", "escape"),
+ ("attrifyString", "atr"),
("attrifyInt", "ts"),
("attrifyFloat", "ts"),
("attrifyBool", "bs"),
diff --git a/tests/sendurl.ur b/tests/sendurl.ur
new file mode 100644
index 00000000..8264305a
--- /dev/null
+++ b/tests/sendurl.ur
@@ -0,0 +1,11 @@
+fun main () =
+ let
+ fun getIt () = return (bless "http://www.yahoo.com/")
+ in
+ s <- source <xml/>;
+ return <xml><body>
+ <dyn signal={signal s}/>
+
+ <button onclick={v <- rpc (getIt ()); set s <xml><a href={v}>Go!</a></xml>}/>
+ </body></xml>
+ end
diff --git a/tests/sendurl.urp b/tests/sendurl.urp
new file mode 100644
index 00000000..4bb6273e
--- /dev/null
+++ b/tests/sendurl.urp
@@ -0,0 +1,4 @@
+debug
+allow url http://www.yahoo.com/
+
+sendurl
diff --git a/tests/sendurl.urs b/tests/sendurl.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/sendurl.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page