From: Manolo Carrasco Date: Fri, 19 Oct 2012 07:15:03 +0000 (+0200) Subject: re-use gwt dom methods to check whether a node is attached to the dom X-Git-Tag: release-1.3.2~45 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab19561d8a428088b1136cbbb1a26c5d5be0b467;p=gwtquery.git re-use gwt dom methods to check whether a node is attached to the dom --- 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 9d384a19..8a6c589b 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 @@ -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