From a0ff70a5841a70c1eaa73b7564f02dc51a5064df Mon Sep 17 00:00:00 2001 From: Julien Dramaix Date: Fri, 17 Aug 2012 12:52:23 +0000 Subject: [PATCH] bug in nextAll(String filter) method --- .../com/google/gwt/query/client/GQuery.java | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index 63bfe9f6..134e84cb 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -17,11 +17,6 @@ package com.google.gwt.query.client; import static com.google.gwt.query.client.plugins.QueuePlugin.Queue; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JsArray; @@ -68,6 +63,11 @@ import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.GqUi; import com.google.gwt.user.client.ui.Widget; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + /** * GwtQuery is a GWT clone of the popular jQuery library. */ @@ -2133,11 +2133,21 @@ public class GQuery implements Lazy { /** * Removes all elements from the set of matched elements that do not pass the * specified css expression. This method is used to narrow down the results of - * a search. Provide a comma-separated list of expressions to apply multiple - * filters at once. + * a search. */ + //TODO performance bad... public GQuery filter(String... filters) { JsNodeArray array = JsNodeArray.create(); + /*StringBuilder filterBuilder = new StringBuilder(); + for (int i = 0; i < filters.length ; i++){ + filterBuilder.append(filters[i]); + if (i < filters.length - 1){ + filterBuilder.append(","); + } + } + + String filter = filterBuilder.toString();*/ + for (String f : filters) { for (Element e : elements) { boolean ghostParent = false; @@ -2159,6 +2169,7 @@ public class GQuery implements Lazy { } } } + return pushStack(unique(array), "filter", filters[0]); } @@ -2870,6 +2881,7 @@ public class GQuery implements Lazy { for (Element e : elements) { allNextSiblingElements(e.getNextSiblingElement(), result, null, null, filter); } + return pushStack(unique(result), "nextAll", getSelector()); } -- 2.39.5