From c6a0211e57cfc8da15f7993e71e27256aefc7f65 Mon Sep 17 00:00:00 2001 From: jeresig Date: Thu, 3 Dec 2009 14:20:06 -0500 Subject: [PATCH] Minor syntax changes to the winnow function. --- src/traversing.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/traversing.js b/src/traversing.js index 5836ab578..388cd350e 100644 --- a/src/traversing.js +++ b/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 ); -- 2.39.5