diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2016-01-19 13:04:37 -0500 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2016-01-20 13:23:01 -0500 |
commit | 4d3050b3d80dc58cdcca0ce7bfdd780e50b0483f (patch) | |
tree | 640874b4aa99919cb48a14811abb73414a30e5cc /src | |
parent | 5c01cb1cc4a41b29d6739d061de8217c33037639 (diff) | |
download | jquery-4d3050b3d80dc58cdcca0ce7bfdd780e50b0483f.tar.gz jquery-4d3050b3d80dc58cdcca0ce7bfdd780e50b0483f.zip |
Traversing: restore jQuery push behavior in .find
Fixes gh-2370
Close gh-2848
Diffstat (limited to 'src')
-rw-r--r-- | src/traversing/findFilter.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/traversing/findFilter.js b/src/traversing/findFilter.js index f3a929e53..913034933 100644 --- a/src/traversing/findFilter.js +++ b/src/traversing/findFilter.js @@ -53,9 +53,8 @@ jQuery.filter = function( expr, elems, not ) { jQuery.fn.extend( { find: function( selector ) { - var i, + var i, ret, len = this.length, - ret = [], self = this; if ( typeof selector !== "string" ) { @@ -68,11 +67,13 @@ jQuery.fn.extend( { } ) ); } + ret = this.pushStack( [] ); + for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } - return this.pushStack( len > 1 ? jQuery.uniqueSort( ret ) : ret ); + return len > 1 ? jQuery.uniqueSort( ret ) : ret; }, filter: function( selector ) { return this.pushStack( winnow( this, selector || [], false ) ); |