[Jifty-commit] r2490 - in jifty/trunk: lib/Jifty/Web/Form

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Jan 11 13:57:28 EST 2007


Author: trs
Date: Thu Jan 11 13:57:27 2007
New Revision: 2490

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web/Form/Element.pm

Log:
 r18805 at zot:  tom | 2007-01-11 13:56:56 -0500
 Use Jifty::JSON::objToJson to properly escape JS values (in particular single quotes in button labels were causing problems)


Modified: jifty/trunk/lib/Jifty/Web/Form/Element.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Element.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Element.pm	Thu Jan 11 13:57:27 2007
@@ -358,11 +358,11 @@
     my $self = shift;
     my $key  = $self->key_binding;
     if ($key) {
-        return "Jifty.KeyBindings.add(" . "'"
-                . uc($key) . "', "
-                . "'click', " . "'"
-                . $self->id . "'," . "'"
-                . $self->label . "'"
+        return "Jifty.KeyBindings.add("
+                . Jifty::JSON::objToJson( uc($key), { singlequote => 1 } ).","
+                . "'click', "
+                . Jifty::JSON::objToJson( $self->id, { singlequote => 1 } ).","
+                . Jifty::JSON::objToJson( $self->label, { singlequote => 1 } )
                 . ");";
     }
 }


More information about the Jifty-commit mailing list