gwtquery
gwtquery copied to clipboard
Bug in JsUtils.prop, when fetching an empty String it returns null
Hi,
I'm using GWT 2.7.0 and gwtquery 1.4.3 and I've encountered the following bug:
When using public static <T> T prop(JavaScriptObject o, Object id)
to retrieve a property that contains an empty String, it instead returns null
.
The following snippet of code can be used to replicate the problem:
JavaScriptObject jso = JavaScriptObject.createObject();
JsUtils.prop(jso, "property", "");
Object property = JsUtils.prop(jso, "property");
Here, I expected property to be an empty String, but instead it was null
.
In order to get the empty String I had to use Properties, as can be seen in the following snippet of code:
JavaScriptObject jso = JavaScriptObject.createObject();
JsUtils.prop(jso, "property", "");
Properties propsJso = jso.cast();
String property = propsJso.getStr("property");
However, I expected the first snippet to return the same value.
Thanks, Luís