diff options
author | jeresig <jeresig@gmail.com> | 2009-12-03 14:20:06 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2009-12-03 14:20:06 -0500 |
commit | c6a0211e57cfc8da15f7993e71e27256aefc7f65 (patch) | |
tree | dd48a5ae4408c64411e8346f8f945db160d5ae63 | |
parent | c2ebd0982609b98d6a389eea792d7a465dccc47a (diff) | |
download | jquery-c6a0211e57cfc8da15f7993e71e27256aefc7f65.tar.gz jquery-c6a0211e57cfc8da15f7993e71e27256aefc7f65.zip |
Minor syntax changes to the winnow function.
-rw-r--r-- | src/traversing.js | 15 |
1 files 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 ); |