aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Panizo <adolfo.panizo@gmail.com>2014-12-26 18:16:01 +0100
committerAdolfo Panizo <adolfo.panizo@gmail.com>2014-12-26 18:16:01 +0100
commit617443d1157cc3769db6d96bf7149278b51768b4 (patch)
tree680c5abefc20d302fa561777f58cf2401b29c1e5
parentb571d28f9371a4c95837ddf383699d7211572857 (diff)
downloadgwtquery-617443d1157cc3769db6d96bf7149278b51768b4.tar.gz
gwtquery-617443d1157cc3769db6d96bf7149278b51768b4.zip
nodeType property error when using selectors like: $(widget)
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java3
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTestGwt.java9
2 files changed, 10 insertions, 2 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
index 65f26cee..d1833d66 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
@@ -19,7 +19,6 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.core.client.JsArrayMixed;
-import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
@@ -351,7 +350,7 @@ public class JsUtils {
* Check is a javascript object can be cast to an Element
*/
public static native boolean isElement(Object o) /*-{
- return o && o.nodeType && o.nodeName ? true : false;
+ return !!o && 'nodeType' in o && 'nodeName' in o;
}-*/;
/**
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTestGwt.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTestGwt.java
index b509fa00..287e6440 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTestGwt.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTestGwt.java
@@ -133,5 +133,14 @@ public class GQueryWidgetsTestGwt extends GWTTestCase {
b2.click();
assertEquals("red", $(b1).css("color", false));
}
+
+ public void testSelectorWidget() {
+ final Button b1 = new Button("click-me");
+ RootPanel.get().add(b1);
+ GQuery g = $(b1);
+ assertEquals("inline-block", $(b1).css("display"));
+ g.hide();
+ assertEquals("none", $(b1).css("display"));
+ }
}