mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
parent
ebecdac242
commit
d754b50cb5
@ -10,13 +10,14 @@ var isSimple = /^.[^:#\[\.,]*$/,
|
|||||||
|
|
||||||
jQuery.fn.extend({
|
jQuery.fn.extend({
|
||||||
find: function( selector ) {
|
find: function( selector ) {
|
||||||
var self, matched, i,
|
var i,
|
||||||
l = this.length;
|
ret = [],
|
||||||
|
self = this,
|
||||||
|
len = self.length;
|
||||||
|
|
||||||
if ( typeof selector !== "string" ) {
|
if ( typeof selector !== "string" ) {
|
||||||
self = this;
|
|
||||||
return this.pushStack( jQuery( selector ).filter(function() {
|
return this.pushStack( jQuery( selector ).filter(function() {
|
||||||
for ( i = 0; i < l; i++ ) {
|
for ( i = 0; i < len; i++ ) {
|
||||||
if ( jQuery.contains( self[ i ], this ) ) {
|
if ( jQuery.contains( self[ i ], this ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -24,15 +25,14 @@ jQuery.fn.extend({
|
|||||||
}) );
|
}) );
|
||||||
}
|
}
|
||||||
|
|
||||||
matched = [];
|
for ( i = 0; i < len; i++ ) {
|
||||||
for ( i = 0; i < l; i++ ) {
|
jQuery.find( selector, self[ i ], ret );
|
||||||
jQuery.find( selector, this[ i ], matched );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed because $( selector, context ) becomes $( context ).find( selector )
|
// Needed because $( selector, context ) becomes $( context ).find( selector )
|
||||||
matched = this.pushStack( l > 1 ? jQuery.unique( matched ) : matched );
|
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
|
||||||
matched.selector = ( this.selector ? this.selector + " " : "" ) + selector;
|
ret.selector = this.selector ? this.selector + " " + selector : selector;
|
||||||
return matched;
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
has: function( target ) {
|
has: function( target ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user