From: Manolo Carrasco Date: Thu, 20 Nov 2014 10:37:36 +0000 (+0100) Subject: isVisible should use predicate in selectors X-Git-Tag: gwtquery-project-1.4.3~22^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b5f4b2e108b38f2f09866902156b6b6bf48647b9;p=gwtquery.git isVisible should use predicate in selectors --- diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java index 880278cb..ac932e90 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java @@ -16,6 +16,7 @@ package com.google.gwt.query.client.impl; import static com.google.gwt.query.client.GQuery.$; + import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Node; @@ -211,7 +212,7 @@ public class DocumentStyleImpl { * Return whether the element is visible */ public boolean isVisible(Element e) { - return !"none".equalsIgnoreCase(curCSS(e, "display", true)); + return SelectorEngine.filters.get("visible").f(e, 0); } public double num(String val) { diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java index beedb287..0d565d0e 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java @@ -107,7 +107,8 @@ public class SelectorEngine implements HasSelector { filters = JsMap.create(); filters.put("visible", new Predicate(){ public boolean f(Element e, int index) { - return (e.getOffsetWidth() + e.getOffsetHeight()) > 0 && styleImpl.isVisible(e); + return (e.getOffsetWidth() + e.getOffsetHeight()) > 0 && + !"none".equalsIgnoreCase(styleImpl.curCSS(e, "display", true)); } }); filters.put("hidden", new Predicate() {