From: Manolo Carrasco Date: Thu, 14 Jul 2011 07:55:00 +0000 (+0000) Subject: Accept hyphenized keys when creating properties, so as we can copy and paste css... X-Git-Tag: release-1.3.2~275 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1c1e9a718780ac2647216fb2a7966867a0be1183;p=gwtquery.git Accept hyphenized keys when creating properties, so as we can copy and paste css properties --- diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java index 86a7a2c8..4012fd0c 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java @@ -28,7 +28,7 @@ public class Properties extends JavaScriptObject { } public static Properties create(String properties) { - String p = wrapPropertiesString(properties); + String p = camelizePropertiesKeys(wrapPropertiesString(properties)); try { return (Properties) createImpl(p); } catch (Exception e) { @@ -56,6 +56,12 @@ public class Properties extends JavaScriptObject { + "})"; return ret; } + + public static native String camelizePropertiesKeys(String s)/*-{ + return s.replace(/(\w+)\-(\w)(\w*:)/g, function(all, g1, letter, g2) { + return g1 + letter.toUpperCase() + g2; + }); + }-*/; protected Properties() { }