Minor syntax changes to the winnow function.
This commit is contained in:
parent
c2ebd09826
commit
c6a0211e57
|
@ -1,14 +1,19 @@
|
||||||
|
// Implement the identical functionality for filter and not
|
||||||
var winnow = function( elements, qualifier, keep ) {
|
var winnow = function( elements, qualifier, keep ) {
|
||||||
if ( jQuery.isFunction( qualifier ) ) {
|
if ( jQuery.isFunction( qualifier ) ) {
|
||||||
return jQuery.grep(elements, function(elem, i) {
|
return jQuery.grep(elements, function(elem, i) {
|
||||||
return !!qualifier.call( elem, i ) === keep;
|
return !!qualifier.call( elem, i ) === keep;
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if ( qualifier.nodeType ) {
|
} else if ( qualifier.nodeType ) {
|
||||||
return jQuery.grep(elements, function(elem, i) {
|
return jQuery.grep(elements, function(elem, i) {
|
||||||
return (elem === qualifier) === keep;
|
return (elem === qualifier) === keep;
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if ( typeof qualifier === "string" ) {
|
} else if ( typeof qualifier === "string" ) {
|
||||||
var filtered = jQuery.grep(elements, function(elem) { return elem.nodeType === 1; });
|
var filtered = jQuery.grep(elements, function(elem) {
|
||||||
|
return elem.nodeType === 1;
|
||||||
|
});
|
||||||
|
|
||||||
if ( isSimple.test( qualifier ) ) {
|
if ( isSimple.test( qualifier ) ) {
|
||||||
return jQuery.filter(qualifier, filtered, !keep);
|
return jQuery.filter(qualifier, filtered, !keep);
|
||||||
|
|
Loading…
Reference in a new issue