2010-09-08 17:54:33 +00:00
|
|
|
(function( jQuery ) {
|
|
|
|
|
2009-12-04 17:28:47 +00:00
|
|
|
var runtil = /Until$/,
|
|
|
|
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
|
|
|
|
// Note: This RegExp should be improved, or likely pulled from Sizzle
|
2010-03-23 16:12:16 +00:00
|
|
|
rmultiselector = /,/,
|
|
|
|
isSimple = /^.[^:#\[\.,]*$/,
|
2010-10-10 19:36:02 +00:00
|
|
|
slice = Array.prototype.slice,
|
2011-01-14 14:55:40 +00:00
|
|
|
POS = jQuery.expr.match.POS,
|
|
|
|
// 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 ) {
|
2011-03-16 05:16:32 +00:00
|
|
|
var self = this,
|
2011-03-16 18:41:26 +00:00
|
|
|
i, l;
|
2009-03-18 21:15:38 +00:00
|
|
|
|
2011-03-16 05:16:32 +00:00
|
|
|
if ( typeof selector !== "string" ) {
|
|
|
|
return jQuery( selector ).filter(function() {
|
|
|
|
for ( i = 0, l = self.length; i < l; i++ ) {
|
|
|
|
if ( jQuery.contains( self[ i ], this ) ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-03-16 18:41:26 +00:00
|
|
|
var ret = this.pushStack( "", "find", selector ),
|
|
|
|
length, n, r;
|
2011-03-16 05:16:32 +00:00
|
|
|
for ( i = 0, l = this.length; i < l; i++ ) {
|
2009-03-18 21:15:38 +00:00
|
|
|
length = ret.length;
|
|
|
|
jQuery.find( selector, this[i], ret );
|
|
|
|
|
|
|
|
if ( i > 0 ) {
|
|
|
|
// Make sure that the results are unique
|
2011-03-16 05:16:32 +00:00
|
|
|
for ( n = length; n < ret.length; n++ ) {
|
|
|
|
for ( r = 0; r < length; r++ ) {
|
2009-03-18 21:15:38 +00:00
|
|
|
if ( ret[r] === ret[n] ) {
|
|
|
|
ret.splice(n--, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
|
2009-12-09 20:43:13 +00:00
|
|
|
has: function( target ) {
|
|
|
|
var targets = jQuery( target );
|
|
|
|
return this.filter(function() {
|
|
|
|
for ( var i = 0, l = targets.length; i < l; i++ ) {
|
|
|
|
if ( jQuery.contains( this, targets[i] ) ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2009-07-16 07:32:11 +00:00
|
|
|
not: function( selector ) {
|
2009-09-15 00:35:35 +00:00
|
|
|
return this.pushStack( winnow(this, selector, false), "not", selector);
|
2009-07-16 07:32:11 +00:00
|
|
|
},
|
|
|
|
|
2009-03-18 21:15:38 +00:00
|
|
|
filter: function( selector ) {
|
2009-09-15 00:35:35 +00:00
|
|
|
return this.pushStack( winnow(this, selector, true), "filter", selector );
|
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 ) {
|
|
|
|
return !!selector && jQuery.filter( selector, this ).length > 0;
|
|
|
|
},
|
2009-03-18 21:15:38 +00:00
|
|
|
|
2009-12-03 00:05:51 +00:00
|
|
|
closest: function( selectors, context ) {
|
2010-10-10 19:42:56 +00:00
|
|
|
var ret = [], i, l, cur = this[0];
|
2010-09-28 00:59:42 +00:00
|
|
|
|
2009-12-03 00:05:51 +00:00
|
|
|
if ( jQuery.isArray( selectors ) ) {
|
2010-11-09 16:09:07 +00:00
|
|
|
var match, selector,
|
|
|
|
matches = {},
|
|
|
|
level = 1;
|
2010-09-28 00:59:42 +00:00
|
|
|
|
2009-12-03 15:51:04 +00:00
|
|
|
if ( cur && selectors.length ) {
|
2010-10-10 19:42:56 +00:00
|
|
|
for ( i = 0, l = selectors.length; i < l; i++ ) {
|
2009-12-03 16:14:10 +00:00
|
|
|
selector = selectors[i];
|
|
|
|
|
|
|
|
if ( !matches[selector] ) {
|
2010-12-30 06:34:48 +00:00
|
|
|
matches[selector] = jQuery.expr.match.POS.test( selector ) ?
|
2009-12-03 16:14:10 +00:00
|
|
|
jQuery( selector, context || this.context ) :
|
|
|
|
selector;
|
|
|
|
}
|
2009-12-03 00:05:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while ( cur && cur.ownerDocument && cur !== context ) {
|
2009-12-03 16:14:10 +00:00
|
|
|
for ( selector in matches ) {
|
|
|
|
match = matches[selector];
|
2009-12-03 16:05:12 +00:00
|
|
|
|
2009-12-03 16:14:10 +00:00
|
|
|
if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
|
2010-02-26 14:26:14 +00:00
|
|
|
ret.push({ selector: selector, elem: cur, level: level });
|
2009-12-03 00:05:51 +00:00
|
|
|
}
|
|
|
|
}
|
2010-09-28 00:59:42 +00:00
|
|
|
|
2009-12-03 00:05:51 +00:00
|
|
|
cur = cur.parentNode;
|
2010-02-26 14:26:14 +00:00
|
|
|
level++;
|
2009-12-03 00:05:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-28 00:59:42 +00:00
|
|
|
return ret;
|
2009-12-03 00:05:51 +00:00
|
|
|
}
|
|
|
|
|
2010-12-30 06:34:48 +00:00
|
|
|
var pos = POS.test( selectors ) ?
|
2009-12-03 00:05:51 +00:00
|
|
|
jQuery( selectors, context || this.context ) : null;
|
2010-09-28 00:59:42 +00:00
|
|
|
|
2010-10-10 19:42:56 +00:00
|
|
|
for ( i = 0, l = this.length; i < l; i++ ) {
|
|
|
|
cur = this[i];
|
2010-10-10 04:33:02 +00:00
|
|
|
|
2010-10-10 17:37:36 +00:00
|
|
|
while ( cur ) {
|
2010-10-10 19:36:02 +00:00
|
|
|
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
|
2010-10-10 04:33:02 +00:00
|
|
|
ret.push( cur );
|
2010-10-10 17:37:36 +00:00
|
|
|
break;
|
|
|
|
|
2010-10-10 04:33:02 +00:00
|
|
|
} else {
|
2010-10-10 17:37:36 +00:00
|
|
|
cur = cur.parentNode;
|
2010-10-11 11:45:15 +00:00
|
|
|
if ( !cur || !cur.ownerDocument || cur === context ) {
|
2010-10-10 17:37:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-09-28 00:59:42 +00:00
|
|
|
|
2010-06-21 17:50:02 +00:00
|
|
|
ret = ret.length > 1 ? jQuery.unique(ret) : ret;
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2010-06-21 17:50:02 +00:00
|
|
|
return this.pushStack( ret, "closest", selectors );
|
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 ) {
|
|
|
|
if ( !elem || typeof elem === "string" ) {
|
|
|
|
return jQuery.inArray( this[0],
|
|
|
|
// If it receives a string, the selector is used
|
|
|
|
// If it receives nothing, the siblings are used
|
|
|
|
elem ? jQuery( elem ) : this.parent().children() );
|
|
|
|
}
|
|
|
|
// Locate the position of the desired element
|
|
|
|
return jQuery.inArray(
|
|
|
|
// If it receives a jQuery object, the first element is used
|
|
|
|
elem.jquery ? elem[0] : elem, this );
|
|
|
|
},
|
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 ) :
|
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
|
|
|
jQuery.makeArray( selector ),
|
|
|
|
all = jQuery.merge( this.get(), set );
|
|
|
|
|
2010-01-13 05:12:18 +00:00
|
|
|
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
|
|
|
|
all :
|
|
|
|
jQuery.unique( all ) );
|
2009-03-18 21:15:38 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
andSelf: function() {
|
|
|
|
return this.add( this.prevObject );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2010-01-13 05:12:18 +00:00
|
|
|
// A painfully simple check to see if an element is disconnected
|
|
|
|
// from a document (should be improved, where feasible).
|
|
|
|
function isDisconnected( node ) {
|
|
|
|
return !node || !node.parentNode || node.parentNode.nodeType === 11;
|
|
|
|
}
|
|
|
|
|
2009-03-18 21:15:38 +00:00
|
|
|
jQuery.each({
|
2009-12-22 00:58:13 +00:00
|
|
|
parent: function( elem ) {
|
|
|
|
var parent = elem.parentNode;
|
|
|
|
return parent && parent.nodeType !== 11 ? parent : null;
|
|
|
|
},
|
|
|
|
parents: function( elem ) {
|
|
|
|
return jQuery.dir( elem, "parentNode" );
|
|
|
|
},
|
|
|
|
parentsUntil: function( elem, i, until ) {
|
|
|
|
return jQuery.dir( elem, "parentNode", until );
|
|
|
|
},
|
|
|
|
next: function( elem ) {
|
|
|
|
return jQuery.nth( elem, 2, "nextSibling" );
|
|
|
|
},
|
|
|
|
prev: function( elem ) {
|
|
|
|
return jQuery.nth( elem, 2, "previousSibling" );
|
|
|
|
},
|
|
|
|
nextAll: function( elem ) {
|
|
|
|
return jQuery.dir( elem, "nextSibling" );
|
|
|
|
},
|
|
|
|
prevAll: function( elem ) {
|
|
|
|
return jQuery.dir( elem, "previousSibling" );
|
|
|
|
},
|
|
|
|
nextUntil: function( elem, i, until ) {
|
|
|
|
return jQuery.dir( elem, "nextSibling", until );
|
|
|
|
},
|
|
|
|
prevUntil: function( elem, i, until ) {
|
|
|
|
return jQuery.dir( elem, "previousSibling", until );
|
|
|
|
},
|
|
|
|
siblings: function( elem ) {
|
|
|
|
return jQuery.sibling( elem.parentNode.firstChild, elem );
|
|
|
|
},
|
|
|
|
children: function( elem ) {
|
|
|
|
return jQuery.sibling( elem.firstChild );
|
|
|
|
},
|
|
|
|
contents: function( elem ) {
|
|
|
|
return jQuery.nodeName( elem, "iframe" ) ?
|
|
|
|
elem.contentDocument || elem.contentWindow.document :
|
|
|
|
jQuery.makeArray( elem.childNodes );
|
|
|
|
}
|
|
|
|
}, function( name, fn ) {
|
2009-12-04 17:28:47 +00:00
|
|
|
jQuery.fn[ name ] = function( until, selector ) {
|
2011-01-14 16:21:45 +00:00
|
|
|
var ret = jQuery.map( this, fn, until ),
|
2011-02-15 21:03:23 +00:00
|
|
|
// The variable 'args' was introduced in
|
|
|
|
// https://github.com/jquery/jquery/commit/52a0238
|
|
|
|
// to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
|
|
|
|
// http://code.google.com/p/v8/issues/detail?id=1050
|
|
|
|
args = slice.call(arguments);
|
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" ) {
|
2009-10-26 22:07:57 +00:00
|
|
|
ret = jQuery.filter( selector, ret );
|
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
|
|
|
}
|
|
|
|
|
2011-01-14 14:55:40 +00:00
|
|
|
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
|
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-12-04 17:28:47 +00:00
|
|
|
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
|
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
|
|
|
ret = ret.reverse();
|
|
|
|
}
|
2009-03-18 21:15:38 +00:00
|
|
|
|
2011-01-14 16:21:45 +00:00
|
|
|
return this.pushStack( ret, name, args.join(",") );
|
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 ?
|
|
|
|
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 ) {
|
2010-11-09 16:09:07 +00:00
|
|
|
var matched = [],
|
|
|
|
cur = elem[ dir ];
|
|
|
|
|
2010-01-21 01:10:34 +00:00
|
|
|
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
|
2009-10-26 22:07:57 +00:00
|
|
|
if ( cur.nodeType === 1 ) {
|
|
|
|
matched.push( cur );
|
|
|
|
}
|
|
|
|
cur = cur[dir];
|
|
|
|
}
|
|
|
|
return matched;
|
|
|
|
},
|
|
|
|
|
|
|
|
nth: function( cur, result, dir, elem ) {
|
|
|
|
result = result || 1;
|
|
|
|
var num = 0;
|
|
|
|
|
|
|
|
for ( ; cur; cur = cur[dir] ) {
|
|
|
|
if ( cur.nodeType === 1 && ++num === result ) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return cur;
|
|
|
|
},
|
|
|
|
|
|
|
|
sibling: function( n, elem ) {
|
|
|
|
var r = [];
|
|
|
|
|
|
|
|
for ( ; n; n = n.nextSibling ) {
|
|
|
|
if ( n.nodeType === 1 && n !== elem ) {
|
|
|
|
r.push( n );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
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 ) {
|
|
|
|
if ( jQuery.isFunction( qualifier ) ) {
|
|
|
|
return jQuery.grep(elements, function( elem, i ) {
|
|
|
|
var retVal = !!qualifier.call( elem, i, elem );
|
|
|
|
return retVal === keep;
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if ( qualifier.nodeType ) {
|
|
|
|
return jQuery.grep(elements, function( elem, i ) {
|
|
|
|
return (elem === qualifier) === keep;
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if ( typeof qualifier === "string" ) {
|
|
|
|
var filtered = jQuery.grep(elements, function( elem ) {
|
|
|
|
return elem.nodeType === 1;
|
|
|
|
});
|
|
|
|
|
|
|
|
if ( isSimple.test( qualifier ) ) {
|
|
|
|
return jQuery.filter(qualifier, filtered, !keep);
|
|
|
|
} else {
|
|
|
|
qualifier = jQuery.filter( qualifier, filtered );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return jQuery.grep(elements, function( elem, i ) {
|
|
|
|
return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
|
|
|
|
});
|
2010-03-31 18:36:24 +00:00
|
|
|
}
|
2010-09-08 17:54:33 +00:00
|
|
|
|
|
|
|
})( jQuery );
|