2009-12-04 17:28:47 +00:00
|
|
|
var runtil = /Until$/,
|
2012-07-02 15:30:22 +00:00
|
|
|
rparentsprev = /^(?:parents|prev(?:Until|All))/,
|
2010-03-23 16:12:16 +00:00
|
|
|
isSimple = /^.[^:#\[\.,]*$/,
|
2012-07-23 16:48:29 +00:00
|
|
|
rneedsContext = jQuery.expr.match.needsContext,
|
2011-01-14 14:55:40 +00:00
|
|
|
// methods guaranteed to produce a unique set when starting from a unique set
|
|
|
|
guaranteedUnique = {
|
|
|
|
children: true,
|
|
|
|
contents: true,
|
|
|
|
next: true,
|
|
|
|
prev: true
|
|
|
|
};
|
2010-10-10 04:33:02 +00:00
|
|
|
|
2009-03-18 21:15:38 +00:00
|
|
|
jQuery.fn.extend({
|
|
|
|
find: function( selector ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
var self, matched, i,
|
|
|
|
l = this.length;
|
2009-03-18 21:15:38 +00:00
|
|
|
|
2011-03-16 05:16:32 +00:00
|
|
|
if ( typeof selector !== "string" ) {
|
2012-11-01 02:43:04 +00:00
|
|
|
self = this;
|
|
|
|
return this.pushStack( jQuery( selector ).filter(function() {
|
2012-12-18 11:29:04 +00:00
|
|
|
for ( i = 0; i < l; i++ ) {
|
2011-03-16 05:16:32 +00:00
|
|
|
if ( jQuery.contains( self[ i ], this ) ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2012-11-01 02:43:04 +00:00
|
|
|
}) );
|
|
|
|
}
|
2009-03-18 21:15:38 +00:00
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
matched = [];
|
|
|
|
for ( i = 0; i < l; i++ ) {
|
|
|
|
jQuery.find( selector, this[ i ], matched );
|
2009-03-18 21:15:38 +00:00
|
|
|
}
|
|
|
|
|
2012-10-30 17:32:53 +00:00
|
|
|
// Needed because $( selector, context ) becomes $( context ).find( selector )
|
2013-01-30 01:48:48 +00:00
|
|
|
matched = this.pushStack( l > 1 ? jQuery.unique( matched ) : matched );
|
2012-12-18 11:29:04 +00:00
|
|
|
matched.selector = ( this.selector ? this.selector + " " : "" ) + selector;
|
|
|
|
return matched;
|
2009-03-18 21:15:38 +00:00
|
|
|
},
|
|
|
|
|
2009-12-09 20:43:13 +00:00
|
|
|
has: function( target ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
var targets = jQuery( target, this ),
|
|
|
|
l = targets.length;
|
2012-07-10 01:38:11 +00:00
|
|
|
|
2009-12-09 20:43:13 +00:00
|
|
|
return this.filter(function() {
|
2012-12-18 11:29:04 +00:00
|
|
|
var i = 0;
|
|
|
|
for ( ; i < l; i++ ) {
|
2009-12-09 20:43:13 +00:00
|
|
|
if ( jQuery.contains( this, targets[i] ) ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2009-07-16 07:32:11 +00:00
|
|
|
not: function( selector ) {
|
2012-10-24 00:22:34 +00:00
|
|
|
return this.pushStack( winnow(this, selector, false) );
|
2009-07-16 07:32:11 +00:00
|
|
|
},
|
|
|
|
|
2009-03-18 21:15:38 +00:00
|
|
|
filter: function( selector ) {
|
2012-10-24 00:22:34 +00:00
|
|
|
return this.pushStack( winnow(this, selector, true) );
|
2009-03-18 21:15:38 +00:00
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-10 17:25:25 +00:00
|
|
|
is: function( selector ) {
|
2011-12-09 01:42:47 +00:00
|
|
|
return !!selector && (
|
2011-09-20 03:50:52 +00:00
|
|
|
typeof selector === "string" ?
|
2012-07-23 16:48:29 +00:00
|
|
|
// If this is a positional/relative selector, check membership in the returned set
|
2011-09-20 03:50:52 +00:00
|
|
|
// so $("p:first").is("p:last") won't return true for a doc with two "p".
|
2012-07-23 16:48:29 +00:00
|
|
|
rneedsContext.test( selector ) ?
|
2012-12-18 11:29:04 +00:00
|
|
|
jQuery( selector, this.context ).index( this[ 0 ] ) >= 0 :
|
2011-09-20 03:50:52 +00:00
|
|
|
jQuery.filter( selector, this ).length > 0 :
|
|
|
|
this.filter( selector ).length > 0 );
|
2009-12-10 17:25:25 +00:00
|
|
|
},
|
2009-03-18 21:15:38 +00:00
|
|
|
|
2009-12-03 00:05:51 +00:00
|
|
|
closest: function( selectors, context ) {
|
2012-12-19 15:38:33 +00:00
|
|
|
var cur,
|
|
|
|
i = 0,
|
2012-07-10 01:38:11 +00:00
|
|
|
l = this.length,
|
2012-12-18 11:29:04 +00:00
|
|
|
matched = [],
|
|
|
|
pos = ( rneedsContext.test( selectors ) || typeof selectors !== "string" ) ?
|
2011-03-22 00:59:20 +00:00
|
|
|
jQuery( selectors, context || this.context ) :
|
|
|
|
0;
|
2010-09-28 00:59:42 +00:00
|
|
|
|
2012-07-10 01:38:11 +00:00
|
|
|
for ( ; i < l; i++ ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
cur = this[ i ];
|
2010-10-10 04:33:02 +00:00
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
while ( cur && cur.ownerDocument && cur !== context ) {
|
|
|
|
if ( pos ? pos.index( cur ) > -1 : jQuery.find.matchesSelector( cur, selectors ) ) {
|
|
|
|
matched.push( cur );
|
2010-10-10 17:37:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-12-18 11:29:04 +00:00
|
|
|
cur = cur.parentElement;
|
2010-10-10 17:37:36 +00:00
|
|
|
}
|
|
|
|
}
|
2010-09-28 00:59:42 +00:00
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
|
2009-03-18 21:15:38 +00:00
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-10 17:25:25 +00:00
|
|
|
// Determine the position of an element within
|
|
|
|
// the matched set of elements
|
|
|
|
index: function( elem ) {
|
2011-06-15 04:38:36 +00:00
|
|
|
|
|
|
|
// No argument, return index in parent
|
|
|
|
if ( !elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
|
2011-06-15 04:38:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// index in selector
|
|
|
|
if ( typeof elem === "string" ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return core_indexOf.call( jQuery( elem ), this[ 0 ] );
|
2009-12-10 17:25:25 +00:00
|
|
|
}
|
2011-06-15 04:38:36 +00:00
|
|
|
|
2009-12-10 17:25:25 +00:00
|
|
|
// Locate the position of the desired element
|
2012-12-18 11:29:04 +00:00
|
|
|
return core_indexOf.call( this,
|
|
|
|
|
2009-12-10 17:25:25 +00:00
|
|
|
// If it receives a jQuery object, the first element is used
|
2012-12-18 11:29:04 +00:00
|
|
|
elem.jquery ? elem[ 0 ] : elem
|
|
|
|
);
|
2009-12-10 17:25:25 +00:00
|
|
|
},
|
2009-03-18 21:15:38 +00:00
|
|
|
|
2009-11-07 15:43:31 +00:00
|
|
|
add: function( selector, context ) {
|
A follow-up to [6578] (which stopped adding expandos to elements that didn't have data). That broke jQuery.unique() (so we're now using the unique from Sizzle). Using Sizzle's unique (which also sorts in document order) changed how add, andSelf, parents, nextAll, prevAll, and siblings work. after and before were changed to not use .add() (in order to guarantee their position in the jQuery set). Also, jQuery.data(elem) was updated to return that element's data object (instead of its ID).
$("<div/>").after("<span/>")
=> [ div, span ]
(calling after on a disconnected DOM node adds the nodes to the end of the jQuery set)
$("<div/>").before("<span/>")
=> [ span, div ]
(calling before on a disconnected DOM node adds the nodes to the beginning of the jQuery set)
$("div").add("span")
=> [ div, span, span, div, span ]
(results now come out in document order)
$("div").find("code").andSelf();
=> [ div, code, code ]
(results now come out in document order)
Same goes for .parents(), .nextAll(), .prevAll(), and .siblings().
Exception: .parents() will still return the results in reverse document order.
jQuery.data(elem)
=> { object of data }
(no longer returns the unique ID assigned to the node)
2009-09-25 17:55:20 +00:00
|
|
|
var set = typeof selector === "string" ?
|
2010-12-29 02:07:04 +00:00
|
|
|
jQuery( selector, context ) :
|
2011-04-17 17:51:24 +00:00
|
|
|
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
|
A follow-up to [6578] (which stopped adding expandos to elements that didn't have data). That broke jQuery.unique() (so we're now using the unique from Sizzle). Using Sizzle's unique (which also sorts in document order) changed how add, andSelf, parents, nextAll, prevAll, and siblings work. after and before were changed to not use .add() (in order to guarantee their position in the jQuery set). Also, jQuery.data(elem) was updated to return that element's data object (instead of its ID).
$("<div/>").after("<span/>")
=> [ div, span ]
(calling after on a disconnected DOM node adds the nodes to the end of the jQuery set)
$("<div/>").before("<span/>")
=> [ span, div ]
(calling before on a disconnected DOM node adds the nodes to the beginning of the jQuery set)
$("div").add("span")
=> [ div, span, span, div, span ]
(results now come out in document order)
$("div").find("code").andSelf();
=> [ div, code, code ]
(results now come out in document order)
Same goes for .parents(), .nextAll(), .prevAll(), and .siblings().
Exception: .parents() will still return the results in reverse document order.
jQuery.data(elem)
=> { object of data }
(no longer returns the unique ID assigned to the node)
2009-09-25 17:55:20 +00:00
|
|
|
all = jQuery.merge( this.get(), set );
|
|
|
|
|
2012-10-16 15:52:48 +00:00
|
|
|
return this.pushStack( jQuery.unique(all) );
|
2009-03-18 21:15:38 +00:00
|
|
|
},
|
|
|
|
|
2012-05-29 16:04:27 +00:00
|
|
|
addBack: function( selector ) {
|
2012-05-31 22:15:57 +00:00
|
|
|
return this.add( selector == null ?
|
2012-06-03 14:42:24 +00:00
|
|
|
this.prevObject : this.prevObject.filter(selector)
|
|
|
|
);
|
2009-03-18 21:15:38 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-05-16 03:14:13 +00:00
|
|
|
jQuery.fn.andSelf = jQuery.fn.addBack;
|
|
|
|
|
2009-03-18 21:15:38 +00:00
|
|
|
jQuery.each({
|
2009-12-22 00:58:13 +00:00
|
|
|
parent: function( elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return elem.parentElement;
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
parents: function( elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return jQuery.dir( elem, "parentElement" );
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
parentsUntil: function( elem, i, until ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return jQuery.dir( elem, "parentElement", until );
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
next: function( elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return elem.nextElementSibling;
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
prev: function( elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return elem.previousElementSibling;
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
nextAll: function( elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return jQuery.dir( elem, "nextElementSibling" );
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
prevAll: function( elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return jQuery.dir( elem, "previousElementSibling" );
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
nextUntil: function( elem, i, until ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return jQuery.dir( elem, "nextElementSibling", until );
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
prevUntil: function( elem, i, until ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return jQuery.dir( elem, "previousElementSibling", until );
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
siblings: function( elem ) {
|
2012-02-22 05:21:18 +00:00
|
|
|
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
children: function( elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
var children = elem.children;
|
|
|
|
|
|
|
|
// documentFragment or document does not have children property
|
|
|
|
return children ? jQuery.merge( [], children ) : jQuery.sibling( elem.firstChild );
|
2009-12-22 00:58:13 +00:00
|
|
|
},
|
|
|
|
contents: function( elem ) {
|
|
|
|
return jQuery.nodeName( elem, "iframe" ) ?
|
|
|
|
elem.contentDocument || elem.contentWindow.document :
|
2012-06-28 00:55:36 +00:00
|
|
|
jQuery.merge( [], elem.childNodes );
|
2009-12-22 00:58:13 +00:00
|
|
|
}
|
|
|
|
}, function( name, fn ) {
|
2009-12-04 17:28:47 +00:00
|
|
|
jQuery.fn[ name ] = function( until, selector ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
var matched = jQuery.map( this, fn, until );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-04 17:28:47 +00:00
|
|
|
if ( !runtil.test( name ) ) {
|
|
|
|
selector = until;
|
|
|
|
}
|
2009-03-18 21:15:38 +00:00
|
|
|
|
A follow-up to [6578] (which stopped adding expandos to elements that didn't have data). That broke jQuery.unique() (so we're now using the unique from Sizzle). Using Sizzle's unique (which also sorts in document order) changed how add, andSelf, parents, nextAll, prevAll, and siblings work. after and before were changed to not use .add() (in order to guarantee their position in the jQuery set). Also, jQuery.data(elem) was updated to return that element's data object (instead of its ID).
$("<div/>").after("<span/>")
=> [ div, span ]
(calling after on a disconnected DOM node adds the nodes to the end of the jQuery set)
$("<div/>").before("<span/>")
=> [ span, div ]
(calling before on a disconnected DOM node adds the nodes to the beginning of the jQuery set)
$("div").add("span")
=> [ div, span, span, div, span ]
(results now come out in document order)
$("div").find("code").andSelf();
=> [ div, code, code ]
(results now come out in document order)
Same goes for .parents(), .nextAll(), .prevAll(), and .siblings().
Exception: .parents() will still return the results in reverse document order.
jQuery.data(elem)
=> { object of data }
(no longer returns the unique ID assigned to the node)
2009-09-25 17:55:20 +00:00
|
|
|
if ( selector && typeof selector === "string" ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
matched = jQuery.filter( selector, matched );
|
A follow-up to [6578] (which stopped adding expandos to elements that didn't have data). That broke jQuery.unique() (so we're now using the unique from Sizzle). Using Sizzle's unique (which also sorts in document order) changed how add, andSelf, parents, nextAll, prevAll, and siblings work. after and before were changed to not use .add() (in order to guarantee their position in the jQuery set). Also, jQuery.data(elem) was updated to return that element's data object (instead of its ID).
$("<div/>").after("<span/>")
=> [ div, span ]
(calling after on a disconnected DOM node adds the nodes to the end of the jQuery set)
$("<div/>").before("<span/>")
=> [ span, div ]
(calling before on a disconnected DOM node adds the nodes to the beginning of the jQuery set)
$("div").add("span")
=> [ div, span, span, div, span ]
(results now come out in document order)
$("div").find("code").andSelf();
=> [ div, code, code ]
(results now come out in document order)
Same goes for .parents(), .nextAll(), .prevAll(), and .siblings().
Exception: .parents() will still return the results in reverse document order.
jQuery.data(elem)
=> { object of data }
(no longer returns the unique ID assigned to the node)
2009-09-25 17:55:20 +00:00
|
|
|
}
|
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
if ( this.length > 1 ) {
|
|
|
|
if ( !guaranteedUnique[ name ] ) {
|
|
|
|
jQuery.unique( matched );
|
|
|
|
}
|
A follow-up to [6578] (which stopped adding expandos to elements that didn't have data). That broke jQuery.unique() (so we're now using the unique from Sizzle). Using Sizzle's unique (which also sorts in document order) changed how add, andSelf, parents, nextAll, prevAll, and siblings work. after and before were changed to not use .add() (in order to guarantee their position in the jQuery set). Also, jQuery.data(elem) was updated to return that element's data object (instead of its ID).
$("<div/>").after("<span/>")
=> [ div, span ]
(calling after on a disconnected DOM node adds the nodes to the end of the jQuery set)
$("<div/>").before("<span/>")
=> [ span, div ]
(calling before on a disconnected DOM node adds the nodes to the beginning of the jQuery set)
$("div").add("span")
=> [ div, span, span, div, span ]
(results now come out in document order)
$("div").find("code").andSelf();
=> [ div, code, code ]
(results now come out in document order)
Same goes for .parents(), .nextAll(), .prevAll(), and .siblings().
Exception: .parents() will still return the results in reverse document order.
jQuery.data(elem)
=> { object of data }
(no longer returns the unique ID assigned to the node)
2009-09-25 17:55:20 +00:00
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
if ( rparentsprev.test( name ) ) {
|
|
|
|
matched.reverse();
|
|
|
|
}
|
A follow-up to [6578] (which stopped adding expandos to elements that didn't have data). That broke jQuery.unique() (so we're now using the unique from Sizzle). Using Sizzle's unique (which also sorts in document order) changed how add, andSelf, parents, nextAll, prevAll, and siblings work. after and before were changed to not use .add() (in order to guarantee their position in the jQuery set). Also, jQuery.data(elem) was updated to return that element's data object (instead of its ID).
$("<div/>").after("<span/>")
=> [ div, span ]
(calling after on a disconnected DOM node adds the nodes to the end of the jQuery set)
$("<div/>").before("<span/>")
=> [ span, div ]
(calling before on a disconnected DOM node adds the nodes to the beginning of the jQuery set)
$("div").add("span")
=> [ div, span, span, div, span ]
(results now come out in document order)
$("div").find("code").andSelf();
=> [ div, code, code ]
(results now come out in document order)
Same goes for .parents(), .nextAll(), .prevAll(), and .siblings().
Exception: .parents() will still return the results in reverse document order.
jQuery.data(elem)
=> { object of data }
(no longer returns the unique ID assigned to the node)
2009-09-25 17:55:20 +00:00
|
|
|
}
|
2009-03-18 21:15:38 +00:00
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
return this.pushStack( matched );
|
2009-03-18 21:15:38 +00:00
|
|
|
};
|
2009-07-25 21:31:59 +00:00
|
|
|
});
|
2009-10-26 22:07:57 +00:00
|
|
|
|
|
|
|
jQuery.extend({
|
|
|
|
filter: function( expr, elems, not ) {
|
|
|
|
if ( not ) {
|
|
|
|
expr = ":not(" + expr + ")";
|
|
|
|
}
|
|
|
|
|
2010-10-10 19:36:02 +00:00
|
|
|
return elems.length === 1 ?
|
2012-12-18 11:29:04 +00:00
|
|
|
jQuery.find.matchesSelector( elems[ 0 ], expr ) ? [ elems[ 0 ] ] : [] :
|
|
|
|
jQuery.find.matches( expr, elems );
|
2009-10-26 22:07:57 +00:00
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-04 17:28:47 +00:00
|
|
|
dir: function( elem, dir, until ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
var cur = elem[ dir ],
|
|
|
|
matched = [];
|
2010-11-09 16:09:07 +00:00
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
while ( cur && ( !until || !jQuery( cur ).is( until ) ) ) {
|
|
|
|
matched.push( cur );
|
|
|
|
cur = cur[ dir ];
|
2009-10-26 22:07:57 +00:00
|
|
|
}
|
2012-12-18 11:29:04 +00:00
|
|
|
|
2009-10-26 22:07:57 +00:00
|
|
|
return matched;
|
|
|
|
},
|
|
|
|
|
|
|
|
sibling: function( n, elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
var matched = [];
|
2009-10-26 22:07:57 +00:00
|
|
|
|
|
|
|
for ( ; n; n = n.nextSibling ) {
|
|
|
|
if ( n.nodeType === 1 && n !== elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
matched.push( n );
|
2009-10-26 22:07:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
return matched;
|
2009-10-26 22:07:57 +00:00
|
|
|
}
|
2009-11-07 15:43:31 +00:00
|
|
|
});
|
2010-03-23 16:12:16 +00:00
|
|
|
|
|
|
|
// Implement the identical functionality for filter and not
|
|
|
|
function winnow( elements, qualifier, keep ) {
|
2011-04-11 15:54:55 +00:00
|
|
|
|
|
|
|
// Can't pass null or undefined to indexOf in Firefox 4
|
|
|
|
// Set to 0 to skip string check
|
|
|
|
qualifier = qualifier || 0;
|
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
var filtered;
|
|
|
|
|
2010-03-23 16:12:16 +00:00
|
|
|
if ( jQuery.isFunction( qualifier ) ) {
|
|
|
|
return jQuery.grep(elements, function( elem, i ) {
|
|
|
|
var retVal = !!qualifier.call( elem, i, elem );
|
|
|
|
return retVal === keep;
|
|
|
|
});
|
2012-12-18 11:29:04 +00:00
|
|
|
}
|
2010-03-23 16:12:16 +00:00
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
if ( qualifier.nodeType ) {
|
2012-10-17 16:50:12 +00:00
|
|
|
return jQuery.grep(elements, function( elem ) {
|
2011-10-27 19:35:09 +00:00
|
|
|
return ( elem === qualifier ) === keep;
|
2010-03-23 16:12:16 +00:00
|
|
|
});
|
2012-12-18 11:29:04 +00:00
|
|
|
}
|
2010-03-23 16:12:16 +00:00
|
|
|
|
2012-12-18 11:29:04 +00:00
|
|
|
if ( typeof qualifier === "string" ) {
|
|
|
|
filtered = jQuery.grep(elements, function( elem ) {
|
2010-03-23 16:12:16 +00:00
|
|
|
return elem.nodeType === 1;
|
|
|
|
});
|
|
|
|
|
|
|
|
if ( isSimple.test( qualifier ) ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return jQuery.filter( qualifier, filtered, !keep );
|
2010-03-23 16:12:16 +00:00
|
|
|
}
|
2012-12-18 11:29:04 +00:00
|
|
|
|
|
|
|
qualifier = jQuery.filter( qualifier, filtered );
|
2010-03-23 16:12:16 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 16:50:12 +00:00
|
|
|
return jQuery.grep(elements, function( elem ) {
|
2012-12-18 11:29:04 +00:00
|
|
|
return ( core_indexOf.call( qualifier, elem ) >= 0 ) === keep;
|
2010-03-23 16:12:16 +00:00
|
|
|
});
|
2010-03-31 18:36:24 +00:00
|
|
|
}
|