Skip to content
Permalink
Browse files

Minor syntax changes to the winnow function.

  • Loading branch information
jeresig committed Dec 3, 2009
1 parent c2ebd09 commit c6a0211e57cfc8da15f7993e71e27256aefc7f65
Showing with 10 additions and 5 deletions.
  1. +10 −5 src/traversing.js
@@ -1,16 +1,21 @@
// Implement the identical functionality for filter and not
var winnow = function( elements, qualifier, keep ) {
if(jQuery.isFunction( qualifier )) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function(elem, i) {
return !!qualifier.call( elem, i ) === keep;
});
} else if( qualifier.nodeType ) {

} 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 )) {
} 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, elements );

0 comments on commit c6a0211

Please sign in to comment.
You can’t perform that action at this time.