aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Carrasco Moñino <manolo@apache.org>2014-12-27 08:26:18 +0100
committerManuel Carrasco Moñino <manolo@apache.org>2014-12-27 08:26:18 +0100
commit2317f553eb2fe1c61e0680caf361859fa2ce3a28 (patch)
tree005430bb475ca216c04db031c02bdffa5edf0628
parentca8329caa010b70f3c610b85226c16c65cda2d57 (diff)
parent3ef29d689bd6e4377b258ced12c62928d73e674a (diff)
downloadgwtquery-2317f553eb2fe1c61e0680caf361859fa2ce3a28.tar.gz
gwtquery-2317f553eb2fe1c61e0680caf361859fa2ce3a28.zip
Merge pull request #327 from apanizo/master
nodeType property error when using selectors like: $(widget). Fixes regression introduced in 8da271599c341f385ae4240f3dd37649aa81b082
-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.java10
2 files changed, 11 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..801992f9 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,15 @@ public class GQueryWidgetsTestGwt extends GWTTestCase {
b2.click();
assertEquals("red", $(b1).css("color", false));
}
+
+ public void testSelectorWidget() {
+ final Button b1 = new Button("Button click");
+ RootPanel.get().add(b1);
+ GQuery g = $(b1);
+ assertTrue(g.isVisible());
+ g.hide();
+ assertFalse(g.isVisible());
+ b1.removeFromParent();
+ }
}