]> source.dussan.org Git - gwtquery.git/commitdiff
re-use gwt dom methods to check whether a node is attached to the dom
authorManolo Carrasco <manolo@apache.org>
Fri, 19 Oct 2012 07:15:03 +0000 (09:15 +0200)
committerManolo Carrasco <manolo@apache.org>
Fri, 19 Oct 2012 07:15:03 +0000 (09:15 +0200)
gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java

index 9d384a19270b908f0f1556f60e4ad02802253c98..8a6c589b643bb15d438ba45b41d3d42e49536a75 100644 (file)
@@ -278,11 +278,9 @@ public class JsUtils {
   /**
    * Return whether a node is dettached to the dom
    */
-  public static native boolean isDettached(Node n) /*-{
-    while (n.parentNode) 
-      n = n.parentNode;
-    return !n.body;
-  }-*/;
+  public static boolean isDettached(Node n) {
+    return !getOwnerDocument(n).getBody().isOrHasChild(n);
+  }
 
   /**
    * Check is a javascript object can be cast to an Element