From: jeresig Date: Thu, 3 Dec 2009 19:20:06 +0000 (-0500) Subject: Minor syntax changes to the winnow function. X-Git-Tag: 1.4a1~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c6a0211e57cfc8da15f7993e71e27256aefc7f65;p=jquery.git Minor syntax changes to the winnow function. --- 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 );