diff --git a/src/core.js b/src/core.js index 41d9b43a..83406181 100644 --- a/src/core.js +++ b/src/core.js @@ -111,3 +111,9 @@ jQuery.sub = function() { migrateWarn( "jQuery.sub() is deprecated" ); return jQuerySub; }; + +// The number of elements contained in the matched element set +jQuery.fn.size = function() { + migrateWarn( "jQuery.fn.size is deprecated; use the length property" ); + return this.length; +}; diff --git a/src/traversing.js b/src/traversing.js new file mode 100644 index 00000000..c0a6d3b1 --- /dev/null +++ b/src/traversing.js @@ -0,0 +1,4 @@ +jQuery.fn.andSelf = function() { + migrateWarn( "jQuery.fn.andSelf is deprecated; use jQuery.fn.addBack" ); + return jQuery.fn.addBack.apply( this, arguments ); +}; diff --git a/test/core.js b/test/core.js index ffa6908b..91a4851c 100644 --- a/test/core.js +++ b/test/core.js @@ -253,3 +253,11 @@ test( "jQuery.sub() - .fn Methods", function(){ }); }); }); + +test( ".size", function(){ + expect( 1 ); + + expectWarning( "size", function() { + jQuery( "
" ).size(); + }); +}); diff --git a/test/index.html b/test/index.html index dc98d50c..74ae4d05 100644 --- a/test/index.html +++ b/test/index.html @@ -39,6 +39,7 @@ + diff --git a/test/traversing.js b/test/traversing.js new file mode 100644 index 00000000..9dab8b09 --- /dev/null +++ b/test/traversing.js @@ -0,0 +1,10 @@ + +module( "traversing" ); + +test( ".andSelf", function(){ + expect( 1 ); + + expectWarning( "andSelf", function() { + jQuery( "