Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the deprecated andSelf in favor of addBack. Fixes #13283 #1170

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/traversing.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ jQuery.fn.extend({
} }
}); });


jQuery.fn.andSelf = jQuery.fn.addBack;

function sibling( cur, dir ) { function sibling( cur, dir ) {
while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}


Expand Down
2 changes: 1 addition & 1 deletion test/unit/effects.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ asyncTest( "hide, fadeOut and slideUp called on element width height and width =
}); });


asyncTest( "Handle queue:false promises", 10, function() { asyncTest( "Handle queue:false promises", 10, function() {
var foo = jQuery( "#foo" ).clone().andSelf(), var foo = jQuery( "#foo" ).clone().addBack(),
step = 1; step = 1;


foo.animate({ foo.animate({
Expand Down
2 changes: 1 addition & 1 deletion test/unit/event.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test("Handler changes and .trigger() order", function() {
path = ""; path = "";


markup markup
.find( "*" ).andSelf().on( "click", function( e ) { .find( "*" ).addBack().on( "click", function( e ) {
path += this.nodeName.toLowerCase() + " "; path += this.nodeName.toLowerCase() + " ";
}) })
.filter( "b" ).on( "click", function( e ) { .filter( "b" ).on( "click", function( e ) {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/queue.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ test("clearQueue() clears the fx queue", function() {
}); });


asyncTest( "fn.promise() - called when fx queue is empty", 3, function() { asyncTest( "fn.promise() - called when fx queue is empty", 3, function() {
var foo = jQuery( "#foo" ).clone().andSelf(), var foo = jQuery( "#foo" ).clone().addBack(),
promised = false; promised = false;


foo.queue( function( next ) { foo.queue( function( next ) {
Expand Down
10 changes: 8 additions & 2 deletions test/unit/traversing.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test( "find(String)", function() {
// using contents will get comments regular, text, and comment nodes // using contents will get comments regular, text, and comment nodes
var j = jQuery("#nonnodes").contents(); var j = jQuery("#nonnodes").contents();
equal( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" ); equal( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" );
equal( j.find("div").andSelf().length, 3, "Check node,textnode,comment to find zero divs, but preserves pushStack" ); equal( j.find("div").addBack().length, 3, "Check node,textnode,comment to find zero divs, but preserves pushStack" );


deepEqual( jQuery("#qunit-fixture").find("> div").get(), q( "foo", "nothiddendiv", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" ); deepEqual( jQuery("#qunit-fixture").find("> div").get(), q( "foo", "nothiddendiv", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" );
deepEqual( jQuery("#qunit-fixture").find("> #foo, > #moretests").get(), q( "foo", "moretests" ), "find child elements" ); deepEqual( jQuery("#qunit-fixture").find("> #foo, > #moretests").get(), q( "foo", "moretests" ), "find child elements" );
Expand Down Expand Up @@ -38,7 +38,7 @@ test( "find(node|jQuery object)", function() {
equal( $two.find( $first ).length, 0, "first is in the collection and not within two" ); equal( $two.find( $first ).length, 0, "first is in the collection and not within two" );
equal( $two.find( $first ).length, 0, "first is in the collection and not within two(node)" ); equal( $two.find( $first ).length, 0, "first is in the collection and not within two(node)" );


equal( $two.find( $foo[ 0 ] ).andSelf().length, 2, "find preserves the pushStack, see #12009" ); equal( $two.find( $foo[ 0 ] ).addBack().length, 2, "find preserves the pushStack, see #12009" );
}); });


test("is(String|undefined)", function() { test("is(String|undefined)", function() {
Expand Down Expand Up @@ -690,3 +690,9 @@ test("index(no arg) #10977", function() {


equal( jQuery( div ).index(), 0, "If jQuery#index called on element whos parent is fragment, it still should work correctly" ); equal( jQuery( div ).index(), 0, "If jQuery#index called on element whos parent is fragment, it still should work correctly" );
}); });

test("drop addSelf support #13283", function() {
expect( 1 );

ok( typeof jQuery.fn.andSelf === "undefined", jQuery.fn.andSelf);
});