Commit f76518e3 authored by Dave Methvin's avatar Dave Methvin Committed by Rick Waldron

Rename .andSelf to .addBack, deprecate .andSelf #9800

parent ca48d490
...@@ -143,11 +143,13 @@ jQuery.fn.extend({ ...@@ -143,11 +143,13 @@ jQuery.fn.extend({
jQuery.unique( all ) ); jQuery.unique( all ) );
}, },
andSelf: function() { addBack: function() {
return this.add( this.prevObject ); return this.add( this.prevObject );
} }
}); });
jQuery.fn.andSelf = jQuery.fn.addBack;
// A painfully simple check to see if an element is disconnected // A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible). // from a document (should be improved, where feasible).
function isDisconnected( node ) { function isDisconnected( node ) {
......
...@@ -402,12 +402,12 @@ test("has(Arrayish)", function() { ...@@ -402,12 +402,12 @@ test("has(Arrayish)", function() {
deepEqual( simple.get(), q("qunit-fixture"), "Only adds elements once" ); deepEqual( simple.get(), q("qunit-fixture"), "Only adds elements once" );
}); });
test("andSelf()", function() { test("addBack()", function() {
expect(4); expect(4);
deepEqual( jQuery("#en").siblings().andSelf().get(), q("sndp", "en", "sap"), "Check for siblings and self" ); deepEqual( jQuery("#en").siblings().addBack().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("#foo").children().addBack().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("#sndp, #en").parent().addBack().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("#groups").parents("p, div").addBack().get(), q("qunit-fixture", "ap", "groups"), "Check for parents and self" );
}); });
test("siblings([String])", function() { test("siblings([String])", function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment