From b5f4b2e108b38f2f09866902156b6b6bf48647b9 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Thu, 20 Nov 2014 11:37:36 +0100 Subject: isVisible should use predicate in selectors --- .../main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java | 3 ++- .../src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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() { -- cgit v1.2.3