From: Manuel Carrasco MoƱino Date: Tue, 10 Sep 2013 07:08:30 +0000 (+0200) Subject: Implement jquery addBack method X-Git-Tag: release-1.4.0~38^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=252e315e1ac951af10dd23a085296db10aa0b37f;p=gwtquery.git Implement jquery addBack method --- 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 cac907f1..6c179aaf 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 @@ -825,6 +825,14 @@ public class GQuery implements Lazy { return add($(selector)); } + /** + * Add the previous selection to the current selection. Useful for traversing elements, and then + * adding something that was matched before the last traversal. + */ + public GQuery addBack() { + return previousObject != null ? add(previousObject) : this; + } + /** * Adds the specified classes to each matched element. */ @@ -899,9 +907,11 @@ public class GQuery implements Lazy { /** * Add the previous selection to the current selection. Useful for traversing elements, and then * adding something that was matched before the last traversal. + * @deprecated use addBack() instead */ + @Deprecated public GQuery andSelf() { - return previousObject != null ? add(previousObject) : this; + return addBack(); } /** @@ -2348,7 +2358,7 @@ public class GQuery implements Lazy { * query) */ public GQuery getPreviousObject() { - return previousObject; + return end(); } private native Element getPreviousSiblingElement(Element elem) /*-{