From d133ac4616ac53f82263f3718857772b6b0ddf36 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Thu, 7 Jan 2016 12:25:47 -0500 Subject: [PATCH] Revert "Deprecated: Drop size and andSelf methods" This reverts commit f1913cf0316edbab77a081ae9c2ee218a61ce5a7. --- src/deprecated.js | 10 +++++++++- test/unit/deprecated.js | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/deprecated.js b/src/deprecated.js index 78885266d..1dcfbf335 100644 --- a/src/deprecated.js +++ b/src/deprecated.js @@ -1,5 +1,6 @@ define( [ - "./core" + "./core", + "./traversing" ], function( jQuery ) { jQuery.fn.extend( { @@ -23,4 +24,11 @@ jQuery.fn.extend( { } } ); +// The number of elements contained in the matched element set +jQuery.fn.size = function() { + return this.length; +}; + +jQuery.fn.andSelf = jQuery.fn.addBack; + } ); diff --git a/test/unit/deprecated.js b/test/unit/deprecated.js index f474dc6c3..dc8911cfd 100644 --- a/test/unit/deprecated.js +++ b/test/unit/deprecated.js @@ -39,3 +39,10 @@ QUnit.test( "delegate/undelegate", function( assert ) { .undelegate( "b", "click" ) .remove(); } ); + +if ( jQuery.fn.size ) { +QUnit.test( "size()", function( assert ) { + assert.expect( 1 ); + equal( jQuery( "#qunit-fixture p" ).size(), 6, "Get Number of Elements Found" ); +} ); +} -- 2.39.5