aboutsummaryrefslogtreecommitdiffstats
path: root/src/traversing.js
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2009-12-03 14:20:06 -0500
committerjeresig <jeresig@gmail.com>2009-12-03 14:20:06 -0500
commitc6a0211e57cfc8da15f7993e71e27256aefc7f65 (patch)
treedd48a5ae4408c64411e8346f8f945db160d5ae63 /src/traversing.js
parentc2ebd0982609b98d6a389eea792d7a465dccc47a (diff)
downloadjquery-c6a0211e57cfc8da15f7993e71e27256aefc7f65.tar.gz
jquery-c6a0211e57cfc8da15f7993e71e27256aefc7f65.zip
Minor syntax changes to the winnow function.
Diffstat (limited to 'src/traversing.js')
-rw-r--r--src/traversing.js15
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 );