]> source.dussan.org Git - jquery.git/commitdiff
Minor syntax changes to the winnow function.
authorjeresig <jeresig@gmail.com>
Thu, 3 Dec 2009 19:20:06 +0000 (14:20 -0500)
committerjeresig <jeresig@gmail.com>
Thu, 3 Dec 2009 19:20:06 +0000 (14:20 -0500)
src/traversing.js

index 5836ab578ce1334140cb470192f1c67810317ad6..388cd350efcb8c2a7f46f6d9ac95d722f803b2fa 100644 (file)
@@ -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 );