Traversing: restore jQuery push behavior in .find

Fixes gh-2370
Close gh-2848
This commit is contained in:
Timmy Willison 2016-01-19 13:04:37 -05:00
parent 5c01cb1cc4
commit 4d3050b3d8

View File

@ -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 ) );