]> source.dussan.org Git - gwtquery.git/commitdiff
handle empty properties values
authorManolo Carrasco <manolo@apache.org>
Fri, 29 Jul 2011 16:03:46 +0000 (16:03 +0000)
committerManolo Carrasco <manolo@apache.org>
Fri, 29 Jul 2011 16:03:46 +0000 (16:03 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java
gwtquery-core/src/test/java/com/google/gwt/query/client/JreQueryCoreTest.java

index 4012fd0c31099370f2d0c6c5412289dd322f4bf5..167298c5f2a2ac37e006ff2be21e64977156d544 100644 (file)
@@ -49,10 +49,9 @@ public class Properties extends JavaScriptObject {
         .replaceFirst("^[{\\(]+(|.*[^}\\)])[}\\)]+$", "$1") // Remove ({})\r
         .replaceAll("\\('([^\\)]+)'\\)" , "($1)") // Remove quotes\r
         .replaceAll(",+([\\w-]+:+)" , ";$1") // put semicolon\r
-        .replaceAll(":\\s*[\"']?([^;]+)([;]+|$)[\"']?\\s*", ":'$1',") // put quotes\r
+        .replaceAll(":\\s*[\"']?([^';]*)[\"']?\\s*(;+|$)", ":'$1',") // put quotes\r
         .replaceAll(":'(-?[\\d\\.]+|null|false|true)',", ":$1,") // numbers do not need quote\r
         .replaceFirst("[;,]$", "") // remove endings \r
-        .replaceAll("\\s*[']+\\s*", "'") // remove duplicates\r
         + "})";\r
     return ret;\r
   }\r
index 48c9dda06ee49dde08d122a747563dad47379daf..01239aeb17b6aa445470f2f34f404862cd731c79 100644 (file)
@@ -56,6 +56,8 @@ public class JreQueryCoreTest extends GWTTestCase {
         .wrapPropertiesString("b: 'a'; c: 1, /*gg: aadf*/d: url('https://test.com');,e:null,f:false"));
     assertEquals("({color:'rgb(0,0,139)',background:'red'})", Properties
         .wrapPropertiesString("color: 'rgb(0, 0,139)', background: red"));
+    assertEquals("({width:'',top:''})", Properties
+        .wrapPropertiesString("width: '' ; top:'' ;"));
   }
 
 }