]> source.dussan.org Git - gwtquery.git/commitdiff
Accept hyphenized keys when creating properties, so as we can copy and paste css...
authorManolo Carrasco <manolo@apache.org>
Thu, 14 Jul 2011 07:55:00 +0000 (07:55 +0000)
committerManolo Carrasco <manolo@apache.org>
Thu, 14 Jul 2011 07:55:00 +0000 (07:55 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java

index 86a7a2c8e34034b51b83cb4a11cd83fb9d9a4bda..4012fd0c31099370f2d0c6c5412289dd322f4bf5 100644 (file)
@@ -28,7 +28,7 @@ public class Properties extends JavaScriptObject {
   }\r
   \r
   public static Properties create(String properties) {\r
-    String p = wrapPropertiesString(properties);\r
+    String p = camelizePropertiesKeys(wrapPropertiesString(properties));\r
     try {\r
       return (Properties) createImpl(p);\r
     } catch (Exception e) {\r
@@ -56,6 +56,12 @@ public class Properties extends JavaScriptObject {
         + "})";\r
     return ret;\r
   }\r
+  \r
+  public static native String camelizePropertiesKeys(String s)/*-{\r
+    return s.replace(/(\w+)\-(\w)(\w*:)/g, function(all, g1, letter, g2) {\r
+      return g1 + letter.toUpperCase() + g2;\r
+    });\r
+  }-*/;\r
 \r
   protected Properties() {\r
   }\r