FUNC_BEFORE = 3;\r
\r
private static final String OLD_DATA_PREFIX = "old-";\r
- \r
+\r
private static JsMap<Class<? extends GQuery>, Plugin<? extends GQuery>> plugins;\r
\r
private static DocumentStyleImpl styleImpl = GWT.create(DocumentStyleImpl.class);\r
\r
private static Element windowData = null;\r
- \r
- //Sizzle POS regex : usefull in some methods\r
+\r
+ // Sizzle POS regex : usefull in some methods\r
private static final String POS_REGEX = ":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\))?(?=[^\\-]|$)";\r
\r
/**\r
}\r
NodeList<Element> n = engine.select(selector, context);\r
JsNodeArray res = copyNodeList(n);\r
- \r
+\r
currentSelector = selector;\r
- currentContext = context != null ? context : document;\r
- \r
+ currentContext = context != null ? context : document;\r
+\r
return setArray(res);\r
\r
}\r
* @param duration the duration in milliseconds of the animation\r
* @param easing the easing function to use for the transition\r
*/\r
- public GQuery animate(Properties p, int duration,\r
- Easing easing, Function... funcs){\r
+ public GQuery animate(Properties p, int duration, Easing easing,\r
+ Function... funcs) {\r
return as(Effects).animate(p, duration, easing, funcs);\r
}\r
\r
* </pre>\r
* \r
* The duration of the animation is 500ms.\r
- * \r
+ * \r
* @param prop the property to animate : "cssName:'value'"\r
* @param funcs an array of {@link Function} called once the animation is\r
* complete\r
* @param duration the duration in milliseconds of the animation\r
*/\r
- public GQuery animate(String prop, Function... funcs){\r
+ public GQuery animate(String prop, Function... funcs) {\r
return as(Effects).animate(prop, funcs);\r
}\r
\r
* can be animated but background-color cannot be.) Property values are\r
* treated as a number of pixels unless otherwise specified. The units em and\r
* % can be specified where applicable.\r
- *\r
+ * \r
* \r
* Example:\r
* \r
* parameter\r
* \r
*/\r
- public GQuery bind(String eventType, final Object data, final Function... funcs) {\r
+ public GQuery bind(String eventType, final Object data,\r
+ final Function... funcs) {\r
return as(Events).bind(eventType, data, funcs);\r
}\r
\r
ret.currentSelector = currentSelector;\r
return ret;\r
}\r
- \r
+\r
/**\r
- * Get the first ancestor element that matches the selector (for each matched element), beginning at the\r
- * current element and progressing up through the DOM tree.\r
+ * Get the first ancestor element that matches the selector (for each matched\r
+ * element), beginning at the current element and progressing up through the\r
+ * DOM tree.\r
* \r
* @param selector\r
* @return\r
*/\r
- public GQuery closest(String selector){\r
+ public GQuery closest(String selector) {\r
return closest(selector, null);\r
}\r
- \r
+\r
/**\r
* Returns a {@link Map} object as key a selector and as value the list of\r
* ancestor elements matching this selectors, beginning at the first matched\r
&& current != context) {\r
// for each selector, check if the current element match it.\r
for (String selector : matches.keySet()) {\r
- \r
+\r
GQuery pos = matches.get(selector);\r
- \r
+\r
boolean match = pos != null ? pos.index(current) > -1\r
: $(current).is(selector);\r
- \r
+\r
if (match) {\r
- \r
+\r
List<Element> elementsMatchingSelector = results.get(selector);\r
- \r
+\r
if (elementsMatchingSelector == null) {\r
elementsMatchingSelector = new ArrayList<Element>();\r
results.put(selector, elementsMatchingSelector);\r
}\r
- \r
+\r
elementsMatchingSelector.add(current);\r
}\r
}\r
\r
return results;\r
}\r
- \r
+\r
/**\r
- * Get the first ancestor element that matches the selector (for each matched element), beginning at the\r
- * current element and progressing up through the DOM tree until reach the <code>context</code> node.\r
+ * Get the first ancestor element that matches the selector (for each matched\r
+ * element), beginning at the current element and progressing up through the\r
+ * DOM tree until reach the <code>context</code> node.\r
+ * \r
+ * If no context is passed in then the context of the gQuery object will be\r
+ * used instead.\r
* \r
- * If no context is passed in then the context of the gQuery object will be used instead.\r
- *\r
*/\r
- public GQuery closest(String selector, Node context){\r
+ public GQuery closest(String selector, Node context) {\r
assert selector != null;\r
- \r
- if (context == null){\r
+\r
+ if (context == null) {\r
context = currentContext;\r
}\r
- \r
+\r
GQuery pos = selector.matches(POS_REGEX) ? $(selector, context) : null;\r
JsNodeArray result = JsNodeArray.create();\r
- \r
- for (Element e : elements()){\r
+\r
+ for (Element e : elements()) {\r
Element current = e;\r
- while (current != null && current.getOwnerDocument() != null && current != context){\r
- boolean match = pos != null ? pos.index(current) > -1 : $(current).is(selector);\r
- if (match){\r
+ while (current != null && current.getOwnerDocument() != null\r
+ && current != context) {\r
+ boolean match = pos != null ? pos.index(current) > -1 : $(current).is(\r
+ selector);\r
+ if (match) {\r
result.addNode(current);\r
break;\r
- }else{\r
+ } else {\r
current = current.getParentElement();\r
- } \r
+ }\r
}\r
}\r
- \r
+\r
return $(unique(result));\r
- \r
- } \r
+\r
+ }\r
\r
/**\r
* Filter the set of elements to those that contain the specified text.\r
public GQuery css(TakesCssValue<?> cssProperty, String value) {\r
return css(cssProperty.getCssName(), value);\r
}\r
- \r
+\r
/**\r
* Returns the numeric value of a css property.\r
*/\r
public double cur(String prop) {\r
return cur(prop, false);\r
}\r
- \r
+\r
/**\r
* Returns the numeric value of a css property.\r
* \r
public double cur(String prop, boolean force) {\r
return size() == 0 ? 0 : styleImpl.cur(get(0), prop, force);\r
}\r
- \r
+\r
/**\r
* Returns value at named data store for the element, as set by data(name,\r
* value).\r
public Object data(String name) {\r
return size() == 0 ? null : data(get(0), name, null);\r
}\r
- \r
+\r
/**\r
* Returns value at named data store for the element, as set by data(name,\r
* value) with desired return type.\r
*/\r
@SuppressWarnings("unchecked")\r
public <T> T data(String name, Class<T> clz) {\r
- return size() == 0 ? null: (T)data(get(0), name, null);\r
+ return size() == 0 ? null : (T) data(get(0), name, null);\r
}\r
- \r
+\r
/**\r
* Stores the value in the named spot with desired return type.\r
*/\r
}\r
return this;\r
}\r
- \r
+\r
/**\r
* Bind a set of functions to the dblclick event of each matched element. Or\r
* trigger the event if no functions are provided.\r
\r
return as(SimpleNamedQueue).delay(milliseconds, queueName);\r
}\r
- \r
+\r
+ /**\r
+ * Attach <code>handlers</code> to one or more events for all elements that\r
+ * match the <code>selector</code>, now or in the future, based on a specific\r
+ * set of root elements.\r
+ * \r
+ * Example:\r
+ * \r
+ * <pre>\r
+ * $("table").delegate("td", "click", new Function(){\r
+ * public void f(Element e){\r
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));\r
+ * }\r
+ * });\r
+ * </pre>\r
+ * \r
+ * This code above add an handler on click event on all cell (the existing\r
+ * oneand the future cell) of all table. This code is equivalent to :\r
+ * \r
+ * <pre>\r
+ * $("table").each(new Function(){\r
+ * public void f(Element table){\r
+ * $("td", table).live("click", new Function(){\r
+ * public void f(Element e){\r
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));\r
+ * }\r
+ * }\r
+ * });\r
+ *\r
+ * </pre>\r
+ * \r
+ * You can pass attach the handlers to many events by specifying a String with espaced event type.\r
+ * ex:\r
+ * <pre>\r
+ * $("div.main").delegate(".subMain", "click dblclick", new Function(){...});\r
+ * </pre>\r
+ * </pre>\r
+ */\r
+ public GQuery delegate(String selector, String eventType,\r
+ Function... handlers) {\r
+ return delegate(selector, eventType, null, handlers);\r
+ }\r
+\r
+ /**\r
+ * Attach <code>handlers</code> to one or more events for all elements that\r
+ * match the <code>selector</code>, now or in the future, based on a specific\r
+ * set of root elements.\r
+ * \r
+ * Example:\r
+ * \r
+ * <pre>\r
+ * $("table").delegate("td", "click", new Function(){\r
+ * public void f(Element e){\r
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));\r
+ * }\r
+ * });\r
+ * </pre>\r
+ * \r
+ * This code above add an handler on click event on all cell (the existing\r
+ * oneand the future cell) of all table. This code is equivalent to :\r
+ * \r
+ * <pre>\r
+ * $("table").each(new Function(){\r
+ * public void f(Element table){\r
+ * $("td", table).live("click", new Function(){\r
+ * public void f(Element e){\r
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));\r
+ * }\r
+ * }\r
+ * });\r
+ *\r
+ * You can pass attach the handlers to many events by specifying a String with espaced event type.\r
+ * ex:\r
+ * <pre>\r
+ * $("div.main").delegate(".subMain", "click dblclick", new Function(){...});\r
+ * </pre>\r
+ * </pre>\r
+ */\r
+ public GQuery delegate(String selector, String eventType, Object data,\r
+ Function... handlers) {\r
+ for (Element e : elements()) {\r
+ $(selector, e).live(eventType, data, handlers);\r
+ }\r
+\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Attach <code>handlers</code> to one or more events for all elements that\r
+ * match the <code>selector</code>, now or in the future, based on a specific\r
+ * set of root elements. \r
+ * \r
+ * Example:\r
+ * \r
+ * <pre>\r
+ * $("table").delegate("td", Event.ONCLICK, new Function(){\r
+ * public void f(Element e){\r
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));\r
+ * }\r
+ * });\r
+ * </pre>\r
+ * \r
+ * This code above add an handler on click event on all cell (the existing\r
+ * oneand the future cell) of all table. This code is equivalent to :\r
+ * \r
+ * <pre>\r
+ * $("table").each(new Function(){\r
+ * public void f(Element table){\r
+ * $("td", table).live(Event.ONCLICK, new Function(){\r
+ * public void f(Element e){\r
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));\r
+ * }\r
+ * }\r
+ * });\r
+ *\r
+ * </pre>\r
+ * \r
+ * You can attach the handlers to many events by using the '|' operator\r
+ * ex:\r
+ * <pre>\r
+ * $("div.main").delegate(".subMain", Event.ONCLICK | Event.ONDBLCLICK, new Function(){...});\r
+ * </pre>\r
+ */\r
+ public GQuery delegate(String selector, int eventbits, Function... handlers) {\r
+ return delegate(selector, eventbits, null, handlers);\r
+ }\r
+\r
+ /**\r
+ * Attach <code>handlers</code> to one or more events for all elements that match the <code>selector</code>, \r
+ * now or in the future, based on a specific set of root elements.\r
+ * The <code>data</code> parameter allows us\r
+ * to pass data to the handler.\r
+ *\r
+ * Example:\r
+ * <pre>\r
+ * $("table").delegate("td", "click", new Function(){\r
+ * public void f(Element e){\r
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));\r
+ * }\r
+ * });\r
+ * </pre>\r
+ * This code above add an handler on click event on all cell (the existing oneand the future cell) of all table.\r
+ * This code is equivalent to :\r
+ * <pre>\r
+ * $("table").each(new Function(){\r
+ * public void f(Element table){\r
+ * $("td", table).live("click", new Function(){\r
+ * public void f(Element e){\r
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));\r
+ * }\r
+ * }\r
+ * });\r
+ *\r
+ * </pre>\r
+ * \r
+ * You can pass attach the handlers to many events by using the '|' operator\r
+ * ex:\r
+ * <pre>\r
+ * $("div.main").delegate(".subMain", Event.ONCLICK | Event.ONDBLCLICK, new Function(){...});\r
+ * </pre>\r
+ */\r
+ public GQuery delegate(String selector, int eventbits, Object data,\r
+ Function... handlers) {\r
+\r
+ for (Element e : elements()) {\r
+ $(selector, e).live(eventbits, data, handlers);\r
+ }\r
+\r
+ return this;\r
+ }\r
+\r
/**\r
* Execute the next function on the Effects queue for the matched elements.\r
* This method is usefull to tell when a function you add in the Effects queue\r
* is ended and so the next function in the queue can start.\r
*/\r
- public GQuery dequeue(){\r
+ public GQuery dequeue() {\r
return as(Effects).dequeue();\r
}\r
- \r
+\r
/**\r
- * Execute the next function on the queue for the matched elements.\r
- * This method is usefull to tell when a function you add in the Effects queue\r
- * is ended and so the next function in the queue can start.\r
+ * Execute the next function on the queue for the matched elements. This\r
+ * method is usefull to tell when a function you add in the Effects queue is\r
+ * ended and so the next function in the queue can start.\r
*/\r
- public GQuery dequeue(String queueName){\r
- if (queueName == null || "fx".equalsIgnoreCase(queueName)){\r
+ public GQuery dequeue(String queueName) {\r
+ if (queueName == null || "fx".equalsIgnoreCase(queueName)) {\r
return as(Effects).dequeue();\r
}\r
- \r
+\r
return as(SimpleNamedQueue).dequeue(queueName);\r
}\r
- \r
+\r
/**\r
* Detach all matched elements from the DOM. This method is the same than\r
* {@link #remove()} method except all data and event handlers are not remove\r
public GQuery detach() {\r
return remove(null, false);\r
}\r
- \r
\r
- \r
/**\r
* Detach from the DOM all matched elements filtered by the\r
* <code>filter</code>.. This method is the same than {@link #remove(String)}\r
public GQuery die(String eventName) {\r
return as(Events).die(eventName);\r
}\r
- \r
+\r
/**\r
* Remove an event handlers previously attached using\r
* {@link #live(int, Function)} In order for this method to function\r
}\r
return this;\r
}\r
- \r
+\r
/**\r
* Returns the working set of nodes as a Java array. <b>Do NOT</b> attempt to\r
* modify this array, e.g. assign to its elements, or call Arrays.sort()\r
}\r
return this;\r
}\r
- \r
+\r
/**\r
* Revert the most recent 'destructive' operation, changing the set of matched\r
* elements to its previous state (right before the destructive operation).\r
}\r
return null;\r
}\r
- \r
+\r
public Node getContext() {\r
return currentContext;\r
}\r
public GQuery live(String eventName, Function... funcs) {\r
return as(Events).live(eventName, null, funcs);\r
}\r
- \r
+\r
/**\r
* Attach a handler for this event to all elements which match the current\r
* selector, now and in the future.\r
*/\r
- public GQuery live(int eventbits, Function...funcs){\r
+ public GQuery live(int eventbits, Function... funcs) {\r
return as(Events).live(eventbits, null, funcs);\r
}\r
\r
* Attach a handler for this event to all elements which match the current\r
* selector, now and in the future.\r
*/\r
- public GQuery live(int eventbits, Object data, Function...funcs){\r
+ public GQuery live(int eventbits, Object data, Function... funcs) {\r
return as(Events).live(eventbits, data, funcs);\r
}\r
\r
/**\r
* <p>\r
* Attach a handler for this event to all elements which match the current\r
- * selector, now and in the future.\r
- * The <code>data</code> parameter allows us to pass data to the handler.\r
+ * selector, now and in the future. The <code>data</code> parameter allows us\r
+ * to pass data to the handler.\r
* <p>\r
* <p>\r
* Ex :\r
*/\r
@SuppressWarnings("unchecked")\r
public <W> List<W> map(Function f) {\r
- @SuppressWarnings("rawtypes")\r
ArrayList ret = new ArrayList();\r
for (int i = 0; i < elements().length; i++) {\r
Object o = f.f(elements()[i], i);\r
*/\r
public com.google.gwt.query.client.GQuery.Offset offset() {\r
Element e = get(0);\r
- return e == null ? new Offset(0, 0) : new Offset(e.getAbsoluteLeft(), e.getAbsoluteTop());\r
+ return e == null ? new Offset(0, 0) : new Offset(e.getAbsoluteLeft(),\r
+ e.getAbsoluteTop());\r
}\r
\r
/**\r
if (size() == 0) {\r
return 0;\r
}\r
- // height including padding and border\r
- int outerHeight = get(0).getOffsetHeight(); \r
+ // height including padding and border\r
+ int outerHeight = get(0).getOffsetHeight();\r
if (includeMargin) {\r
outerHeight += cur("marginTop", true) + cur("marginBottom", true);\r
}\r
return 0;\r
}\r
// width including padding and border\r
- int outerWidth = get(0).getOffsetWidth(); \r
+ int outerWidth = get(0).getOffsetWidth();\r
if (includeMargin) {\r
outerWidth += cur("marginRight", true) + cur("marginLeft", true);\r
}\r
* Please note that {@link #dequeue()} function is needed at the end of your\r
* function to start the next function in the queue. {@see #dequeue()}\r
*/\r
- public GQuery queue(String queueName, Function f){\r
- if (queueName == null || "fx".equalsIgnoreCase(queueName)){\r
+ public GQuery queue(String queueName, Function f) {\r
+ if (queueName == null || "fx".equalsIgnoreCase(queueName)) {\r
return as(Effects).queue(f);\r
}\r
- return as(SimpleNamedQueue).queue(queueName,f);\r
+ return as(SimpleNamedQueue).queue(queueName, f);\r
}\r
\r
/**\r
* from the DOM and not the new element that has replaced it.\r
*/\r
public GQuery replaceWith(GQuery target) {\r
- for (Element el : elements()){\r
+ for (Element el : elements()) {\r
Element nextSibling = el.getNextSiblingElement();\r
- \r
- if (nextSibling != null){\r
+\r
+ if (nextSibling != null) {\r
$(nextSibling).before(target);\r
- }else{\r
+ } else {\r
Element parent = el.getParentElement();\r
$(parent).append(target);\r
}\r
* from the DOM and not the new element that has replaced it.\r
*/\r
public GQuery replaceWith(String html) {\r
- for (Element el : elements()){\r
+ for (Element el : elements()) {\r
Element nextSibling = el.getNextSiblingElement();\r
- \r
- if (nextSibling != null){\r
+\r
+ if (nextSibling != null) {\r
$(nextSibling).before(html);\r
- }else{\r
+ } else {\r
Element parent = el.getParentElement();\r
$(parent).append(html);\r
}\r
* Scrolls the first matched element into view.\r
*/\r
public GQuery scrollIntoView() {\r
- if (size() > 0) scrollIntoViewImpl(get(0));\r
+ if (size() > 0)\r
+ scrollIntoViewImpl(get(0));\r
return this;\r
}\r
\r
* "sliding" manner\r
*/\r
public Effects slideToggle(int millisecs, Function... f) {\r
- return as(Effects).slideToggle(millisecs, f);\r
+ return as(Effects).slideToggle(millisecs, f);\r
}\r
- \r
- \r
+\r
/**\r
* Hide all matched elements by adjusting their height and firing an optional\r
* callback after completion.\r
public Effects slideUp(int millisecs, Function... f) {\r
return as(Effects).slideUp(millisecs, f);\r
}\r
- \r
+\r
/**\r
* Stop the animation currently running.\r
*/\r
- public GQuery stop(){\r
+ public GQuery stop() {\r
return stop(false);\r
}\r
\r
/**\r
* Stop the animation currently running.\r
*/\r
- //TODO: implements jumpToEnd\r
- public GQuery stop(boolean clearQueue){\r
+ // TODO: implements jumpToEnd\r
+ public GQuery stop(boolean clearQueue) {\r
return as(Effects).stop(clearQueue);\r
}\r
\r
return as(Events).trigger(EventsListener.ONSUBMIT);\r
}\r
\r
-\r
- \r
-\r
/**\r
* Return the text contained in the first matched element.\r
*/\r
*/\r
public GQuery unwrap() {\r
\r
- for (Element parent : parent().elements()){\r
- if (!"body".equalsIgnoreCase(parent.getTagName())){\r
+ for (Element parent : parent().elements()) {\r
+ if (!"body".equalsIgnoreCase(parent.getTagName())) {\r
GQuery $parent = $(parent);\r
$parent.replaceWith($parent.children());\r
}\r
}\r
return this;\r
}\r
- \r
+\r
/**\r
* Gets the content of the value attribute of the first matched element,\r
* returns only the first value even if it is a multivalued element. To get an\r
* <code> filter</code> parameter allows to filter the matched set to remove.\r
*/\r
protected GQuery remove(String filter, boolean clean) {\r
- \r
+\r
for (Element e : elements()) {\r
if (filter == null || $(e).filter(filter).length() == 1) {\r
if (clean) {\r
- //clean data linked to the children\r
+ // clean data linked to the children\r
cleanGQData($("*", e).elements());\r
- //clean data linked to the element itself\r
+ // clean data linked to the element itself\r
cleanGQData(e);\r
}\r
Widget w = getAssociatedWidget(e);\r
}\r
}\r
\r
- private void cleanGQData(Element... elements){\r
- for (Element el : elements){\r
+ private void cleanGQData(Element... elements) {\r
+ for (Element el : elements) {\r
EventsListener.clean(el);\r
removeData(el, null);\r
}\r
}\r
return res;\r
}\r
- \r
+\r
private void removeData(Element item, String name) {\r
if (dataCache == null) {\r
windowData = JavaScriptObject.createObject().cast();\r
* </pre>
*
* The duration of the animation is 500ms.
- *
+ *
* @param prop the property to animate : "cssName:'value'"
* @param funcs an array of {@link Function} called once the animation is
* complete
* can be animated but background-color cannot be.) Property values are
* treated as a number of pixels unless otherwise specified. The units em and
* % can be specified where applicable.
- *
+ *
*
* Example:
*
LazyGQuery<T> clone();
/**
- * Get the first ancestor element that matches the selector (for each matched element), beginning at the
- * current element and progressing up through the DOM tree.
+ * Get the first ancestor element that matches the selector (for each matched
+ * element), beginning at the current element and progressing up through the
+ * DOM tree.
*
* @param selector
* @return
Map<String, List<Element>> closest(String[] selectors, Node context);
/**
- * Get the first ancestor element that matches the selector (for each matched element), beginning at the
- * current element and progressing up through the DOM tree until reach the <code>context</code> node.
+ * Get the first ancestor element that matches the selector (for each matched
+ * element), beginning at the current element and progressing up through the
+ * DOM tree until reach the <code>context</code> node.
+ *
+ * If no context is passed in then the context of the gQuery object will be
+ * used instead.
*
- * If no context is passed in then the context of the gQuery object will be used instead.
- *
*/
LazyGQuery<T> closest(String selector, Node context);
*/
LazyGQuery<T> delay(int milliseconds, String queueName);
+ /**
+ * Attach <code>handlers</code> to one or more events for all elements that
+ * match the <code>selector</code>, now or in the future, based on a specific
+ * set of root elements.
+ *
+ * Example:
+ *
+ * <pre>
+ * $("table").delegate("td", "click", new Function(){
+ * public void f(Element e){
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));
+ * }
+ * });
+ * </pre>
+ *
+ * This code above add an handler on click event on all cell (the existing
+ * oneand the future cell) of all table. This code is equivalent to :
+ *
+ * <pre>
+ * $("table").each(new Function(){
+ * public void f(Element table){
+ * $("td", table).live("click", new Function(){
+ * public void f(Element e){
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));
+ * }
+ * }
+ * });
+ *
+ * </pre>
+ *
+ * You can pass attach the handlers to many events by specifying a String with espaced event type.
+ * ex:
+ * <pre>
+ * $("div.main").delegate(".subMain", "click dblclick", new Function(){...});
+ * </pre>
+ * </pre>
+ */
+ LazyGQuery<T> delegate(String selector, String eventType, Function... handlers);
+
+ /**
+ * Attach <code>handlers</code> to one or more events for all elements that
+ * match the <code>selector</code>, now or in the future, based on a specific
+ * set of root elements.
+ *
+ * Example:
+ *
+ * <pre>
+ * $("table").delegate("td", "click", new Function(){
+ * public void f(Element e){
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));
+ * }
+ * });
+ * </pre>
+ *
+ * This code above add an handler on click event on all cell (the existing
+ * oneand the future cell) of all table. This code is equivalent to :
+ *
+ * <pre>
+ * $("table").each(new Function(){
+ * public void f(Element table){
+ * $("td", table).live("click", new Function(){
+ * public void f(Element e){
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));
+ * }
+ * }
+ * });
+ *
+ * You can pass attach the handlers to many events by specifying a String with espaced event type.
+ * ex:
+ * <pre>
+ * $("div.main").delegate(".subMain", "click dblclick", new Function(){...});
+ * </pre>
+ * </pre>
+ */
+ LazyGQuery<T> delegate(String selector, String eventType, Object data, Function... handlers);
+
+ /**
+ * Attach <code>handlers</code> to one or more events for all elements that
+ * match the <code>selector</code>, now or in the future, based on a specific
+ * set of root elements.
+ *
+ * Example:
+ *
+ * <pre>
+ * $("table").delegate("td", Event.ONCLICK, new Function(){
+ * public void f(Element e){
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));
+ * }
+ * });
+ * </pre>
+ *
+ * This code above add an handler on click event on all cell (the existing
+ * oneand the future cell) of all table. This code is equivalent to :
+ *
+ * <pre>
+ * $("table").each(new Function(){
+ * public void f(Element table){
+ * $("td", table).live(Event.ONCLICK, new Function(){
+ * public void f(Element e){
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));
+ * }
+ * }
+ * });
+ *
+ * </pre>
+ *
+ * You can attach the handlers to many events by using the '|' operator
+ * ex:
+ * <pre>
+ * $("div.main").delegate(".subMain", Event.ONCLICK | Event.ONDBLCLICK, new Function(){...});
+ * </pre>
+ */
+ LazyGQuery<T> delegate(String selector, int eventbits, Function... handlers);
+
+ /**
+ * Attach <code>handlers</code> to one or more events for all elements that match the <code>selector</code>,
+ * now or in the future, based on a specific set of root elements.
+ * The <code>data</code> parameter allows us
+ * to pass data to the handler.
+ *
+ * Example:
+ * <pre>
+ * $("table").delegate("td", "click", new Function(){
+ * public void f(Element e){
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));
+ * }
+ * });
+ * </pre>
+ * This code above add an handler on click event on all cell (the existing oneand the future cell) of all table.
+ * This code is equivalent to :
+ * <pre>
+ * $("table").each(new Function(){
+ * public void f(Element table){
+ * $("td", table).live("click", new Function(){
+ * public void f(Element e){
+ * $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED));
+ * }
+ * }
+ * });
+ *
+ * </pre>
+ *
+ * You can pass attach the handlers to many events by using the '|' operator
+ * ex:
+ * <pre>
+ * $("div.main").delegate(".subMain", Event.ONCLICK | Event.ONDBLCLICK, new Function(){...});
+ * </pre>
+ */
+ LazyGQuery<T> delegate(String selector, int eventbits, Object data, Function... handlers);
+
/**
* Execute the next function on the Effects queue for the matched elements.
* This method is usefull to tell when a function you add in the Effects queue
LazyGQuery<T> dequeue();
/**
- * Execute the next function on the queue for the matched elements.
- * This method is usefull to tell when a function you add in the Effects queue
- * is ended and so the next function in the queue can start.
+ * Execute the next function on the queue for the matched elements. This
+ * method is usefull to tell when a function you add in the Effects queue is
+ * ended and so the next function in the queue can start.
*/
LazyGQuery<T> dequeue(String queueName);
* Attach a handler for this event to all elements which match the current
* selector, now and in the future.
*/
- LazyGQuery<T> live(int eventbits, Function...funcs);
+ LazyGQuery<T> live(int eventbits, Function... funcs);
/**
* Attach a handler for this event to all elements which match the current
* selector, now and in the future.
*/
- LazyGQuery<T> live(int eventbits, Object data, Function...funcs);
+ LazyGQuery<T> live(int eventbits, Object data, Function... funcs);
/**
* <p>
* Attach a handler for this event to all elements which match the current
- * selector, now and in the future.
- * The <code>data</code> parameter allows us to pass data to the handler.
+ * selector, now and in the future. The <code>data</code> parameter allows us
+ * to pass data to the handler.
* <p>
* <p>
* Ex :