Made some changes to how .find() works, inlined the duplicate check - should change other methods to act similarly. Goes towards fixing #4240.
This commit is contained in:
parent
4bbb70b4eb
commit
f094c803de
24
src/core.js
24
src/core.js
|
@ -286,18 +286,26 @@ jQuery.fn = jQuery.prototype = {
|
|||
splice: [].splice,
|
||||
|
||||
find: function( selector ) {
|
||||
if ( this.length === 1 ) {
|
||||
var ret = this.pushStack( "", "find", selector );
|
||||
jQuery.find( selector, this[0], ret );
|
||||
return ret;
|
||||
} else {
|
||||
var ret = this.pushStack( "", "find", selector );
|
||||
var ret = this.pushStack( "", "find", selector ), length = 0;
|
||||
|
||||
for ( var i = 0, l = this.length; i < l; i++ ) {
|
||||
length = ret.length;
|
||||
jQuery.find( selector, this[i], ret );
|
||||
|
||||
if ( i > 0 ) {
|
||||
// Make sure that the results are unique
|
||||
for ( var n = length; n < ret.length; n++ ) {
|
||||
for ( var r = 0; r < length; r++ ) {
|
||||
if ( ret[r] === ret[n] ) {
|
||||
ret.splice(n--, 1);
|
||||
break;
|
||||
}
|
||||
//jQuery.find.uniqueSort( ret );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
},
|
||||
|
||||
clone: function( events ) {
|
||||
|
|
Loading…
Reference in a new issue