Skip to content

Commit 81d61ac

Browse files
committed
Traversing: Move .andSelf to its proper file
1 parent 5a4cb3f commit 81d61ac

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

Gruntfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = function(grunt) {
2626
"src/data.js",
2727
"src/manipulation.js",
2828
"src/event.js",
29+
"src/traversing.js",
2930
"src/outro.js"
3031
],
3132
tests: {

src/manipulation.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11

2-
var rscriptType = /\/(java|ecma)script/i,
3-
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
4-
5-
jQuery.fn.andSelf = function() {
6-
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
7-
return oldSelf.apply( this, arguments );
8-
};
2+
var rscriptType = /\/(java|ecma)script/i;
93

104
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
115
if ( !jQuery.clean ) {

src/traversing.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
2+
13
jQuery.fn.andSelf = function() {
2-
migrateWarn( "jQuery.fn.andSelf is deprecated; use jQuery.fn.addBack" );
3-
return jQuery.fn.addBack.apply( this, arguments );
4+
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
5+
return oldSelf.apply( this, arguments );
46
};

test/manipulation.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
11

22
module( "manipulation" );
3-
4-
test( "andSelf", function() {
5-
expect( 2 );
6-
7-
expectWarning( "andSelf", function() {
8-
var $test = jQuery("<div>Beautiful<p>World</p></div>").find("p").andSelf();
9-
equal( $test.length, 2, "correct element count" );
10-
});
11-
});

0 commit comments

Comments
 (0)