From 4653746c44d2aab84cae436664f0aee4c9327d11 Mon Sep 17 00:00:00 2001 From: spgingras Date: Wed, 12 Nov 2014 17:20:58 -0500 Subject: [PATCH] Add varargs Node selector --- .../com/google/gwt/query/client/GQuery.java | 22 +++++++++++++------ 1 file changed, 15 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 ddf72475..32a30e1f 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 @@ -286,7 +286,8 @@ public class GQuery implements Lazy { } /** - * Create a new GQuery given a list of nodes, elements or widgets + * Create a new GQuery given a list of {@link com.google.gwt.dom.client.Node} or + * {@link com.google.gwt.user.client.ui.IsWidget} */ public static GQuery $(List nodesOrWidgets) { JsNodeArray elms = JsNodeArray.create(); @@ -407,6 +408,13 @@ public class GQuery implements Lazy { return $(Arrays.asList(widgets)); } + /** + * Wrap a GQuery around one node or an array of existing ones. + */ + public static GQuery $(Node... nodes) { + return $(Arrays.asList(nodes)); + } + /** * Create an empty JSON object. */ @@ -2545,7 +2553,7 @@ public class GQuery implements Lazy { } return -1; } - + /** * Return the position of the first matched element in relation with its sibblings. */ @@ -3206,14 +3214,14 @@ public class GQuery implements Lazy { } return new GQuery(offParent); } - + /** * Attach an event handler function for one or more events to the selected elements. */ public GQuery on(String eventName, Function... funcs) { return bind(eventName, funcs); } - + /** * Attach an event handler function for one or more events to the selected elements. */ @@ -3234,7 +3242,7 @@ public class GQuery implements Lazy { public GQuery on(String eventName, String selector, Object data, Function... funcs) { return delegate(selector, eventName, data, funcs); } - + /** * Remove all event handlers. */ @@ -3248,7 +3256,7 @@ public class GQuery implements Lazy { public GQuery off(String eventName) { return unbind(eventName, null); } - + /** * Remove an event handler */ @@ -3262,7 +3270,7 @@ public class GQuery implements Lazy { public GQuery off(String eventName, String selector) { return undelegate(selector, eventName); } - + /** * Binds a handler to a particular Event (like Event.ONCLICK) for each matched element. The * handler is executed only once for each element. -- 2.39.5