aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Carrasco Moñino <manolo@apache.org>2014-12-04 08:19:29 +0100
committerManuel Carrasco Moñino <manolo@apache.org>2014-12-04 08:19:29 +0100
commit64dd253a2b1643c475b46b0284e5b37abec30684 (patch)
treefe8479618b8e670c378f9eac66ed69a293f8e278
parent8c445b0fc9b62c0ae14da9b9708d9c2a5c5b2408 (diff)
parentb5f4b2e108b38f2f09866902156b6b6bf48647b9 (diff)
downloadgwtquery-64dd253a2b1643c475b46b0284e5b37abec30684.tar.gz
gwtquery-64dd253a2b1643c475b46b0284e5b37abec30684.zip
Merge pull request #310 from manolo/mcm_visible
isVisible should use predicate in selectors
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java3
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java3
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() {