aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2011-07-29 16:03:46 +0000
committerManolo Carrasco <manolo@apache.org>2011-07-29 16:03:46 +0000
commit942257ae677f02ef602bf653bd3d7e7718e95244 (patch)
tree63686e9dba3edf8322fa432fa8e3ef0d630ba66a
parent61738755c5499cc7214dcc182ae0031a7a0ffdf7 (diff)
downloadgwtquery-942257ae677f02ef602bf653bd3d7e7718e95244.tar.gz
gwtquery-942257ae677f02ef602bf653bd3d7e7718e95244.zip
handle empty properties values
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java3
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/JreQueryCoreTest.java2
2 files changed, 3 insertions, 2 deletions
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 4012fd0c..167298c5 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
@@ -49,10 +49,9 @@ public class Properties extends JavaScriptObject {
.replaceFirst("^[{\\(]+(|.*[^}\\)])[}\\)]+$", "$1") // Remove ({})
.replaceAll("\\('([^\\)]+)'\\)" , "($1)") // Remove quotes
.replaceAll(",+([\\w-]+:+)" , ";$1") // put semicolon
- .replaceAll(":\\s*[\"']?([^;]+)([;]+|$)[\"']?\\s*", ":'$1',") // put quotes
+ .replaceAll(":\\s*[\"']?([^';]*)[\"']?\\s*(;+|$)", ":'$1',") // put quotes
.replaceAll(":'(-?[\\d\\.]+|null|false|true)',", ":$1,") // numbers do not need quote
.replaceFirst("[;,]$", "") // remove endings
- .replaceAll("\\s*[']+\\s*", "'") // remove duplicates
+ "})";
return ret;
}
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/JreQueryCoreTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/JreQueryCoreTest.java
index 48c9dda0..01239aeb 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/JreQueryCoreTest.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/JreQueryCoreTest.java
@@ -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:'' ;"));
}
}