From 252e315e1ac951af10dd23a085296db10aa0b37f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Carrasco=20Mo=C3=B1ino?= Date: Tue, 10 Sep 2013 09:08:30 +0200 Subject: [PATCH] Implement jquery addBack method --- .../java/com/google/gwt/query/client/GQuery.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 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 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) /*-{ -- 2.39.5