]> source.dussan.org Git - jquery.git/commitdiff
Rename .andSelf to .addBack, deprecate .andSelf #9800
authorDave Methvin <dave.methvin@gmail.com>
Wed, 16 May 2012 03:14:13 +0000 (23:14 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Wed, 16 May 2012 03:14:13 +0000 (23:14 -0400)
src/traversing.js
test/unit/traversing.js

index 0627ab4f094553dfe436e2173043778596179dd0..d9be9c7e6f9eab924c5324cc2b89bac3a7e87ba7 100644 (file)
@@ -143,11 +143,13 @@ jQuery.fn.extend({
                        jQuery.unique( all ) );
        },
 
-       andSelf: function() {
+       addBack: function() {
                return this.add( this.prevObject );
        }
 });
 
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
 // A painfully simple check to see if an element is disconnected
 // from a document (should be improved, where feasible).
 function isDisconnected( node ) {
index 39319e4d749a03bf4315f9cd2fc40154fc0f15f9..3400ffea8f6c520a5ebd066785c2ce77270f6dd5 100644 (file)
@@ -402,12 +402,12 @@ test("has(Arrayish)", function() {
        deepEqual( simple.get(), q("qunit-fixture"), "Only adds elements once" );
 });
 
-test("andSelf()", function() {
+test("addBack()", function() {
        expect(4);
-       deepEqual( jQuery("#en").siblings().andSelf().get(), q("sndp", "en", "sap"), "Check for siblings and self" );
-       deepEqual( jQuery("#foo").children().andSelf().get(), q("foo", "sndp", "en", "sap"), "Check for children and self" );
-       deepEqual( jQuery("#sndp, #en").parent().andSelf().get(), q("foo","sndp","en"), "Check for parent and self" );
-       deepEqual( jQuery("#groups").parents("p, div").andSelf().get(), q("qunit-fixture", "ap", "groups"), "Check for parents and self" );
+       deepEqual( jQuery("#en").siblings().addBack().get(), q("sndp", "en", "sap"), "Check for siblings and self" );
+       deepEqual( jQuery("#foo").children().addBack().get(), q("foo", "sndp", "en", "sap"), "Check for children and self" );
+       deepEqual( jQuery("#sndp, #en").parent().addBack().get(), q("foo","sndp","en"), "Check for parent and self" );
+       deepEqual( jQuery("#groups").parents("p, div").addBack().get(), q("qunit-fixture", "ap", "groups"), "Check for parents and self" );
 });
 
 test("siblings([String])", function() {