Permalink
Browse files

Traversing: restore jQuery push behavior in .find

Fixes gh-2370
Close gh-2848
  • Loading branch information...
1 parent 5c01cb1 commit 4d3050b3d80dc58cdcca0ce7bfdd780e50b0483f Timmy Willison committed Jan 19, 2016
Showing with 4 additions and 3 deletions.
  1. +4 −3 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 ) );

0 comments on commit 4d3050b

Please sign in to comment.