@@ 5591-5623 (lines=33) @@ | ||
5588 | }); |
|
5589 | ||
5590 | // Implement the identical functionality for filter and not |
|
5591 | function winnow( elements, qualifier, keep ) { |
|
5592 | ||
5593 | // Can't pass null or undefined to indexOf in Firefox 4 |
|
5594 | // Set to 0 to skip string check |
|
5595 | qualifier = qualifier || 0; |
|
5596 | ||
5597 | if ( jQuery.isFunction( qualifier ) ) { |
|
5598 | return jQuery.grep(elements, function( elem, i ) { |
|
5599 | var retVal = !!qualifier.call( elem, i, elem ); |
|
5600 | return retVal === keep; |
|
5601 | }); |
|
5602 | ||
5603 | } else if ( qualifier.nodeType ) { |
|
5604 | return jQuery.grep(elements, function( elem, i ) { |
|
5605 | return ( elem === qualifier ) === keep; |
|
5606 | }); |
|
5607 | ||
5608 | } else if ( typeof qualifier === "string" ) { |
|
5609 | var filtered = jQuery.grep(elements, function( elem ) { |
|
5610 | return elem.nodeType === 1; |
|
5611 | }); |
|
5612 | ||
5613 | if ( isSimple.test( qualifier ) ) { |
|
5614 | return jQuery.filter(qualifier, filtered, !keep); |
|
5615 | } else { |
|
5616 | qualifier = jQuery.filter( qualifier, filtered ); |
|
5617 | } |
|
5618 | } |
|
5619 | ||
5620 | return jQuery.grep(elements, function( elem, i ) { |
|
5621 | return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; |
|
5622 | }); |
|
5623 | } |
|
5624 | ||
5625 | ||
5626 |
@@ 4923-4950 (lines=28) @@ | ||
4920 | }); |
|
4921 | ||
4922 | // Implement the identical functionality for filter and not |
|
4923 | function winnow( elements, qualifier, keep ) { |
|
4924 | if ( jQuery.isFunction( qualifier ) ) { |
|
4925 | return jQuery.grep(elements, function( elem, i ) { |
|
4926 | var retVal = !!qualifier.call( elem, i, elem ); |
|
4927 | return retVal === keep; |
|
4928 | }); |
|
4929 | ||
4930 | } else if ( qualifier.nodeType ) { |
|
4931 | return jQuery.grep(elements, function( elem, i ) { |
|
4932 | return (elem === qualifier) === keep; |
|
4933 | }); |
|
4934 | ||
4935 | } else if ( typeof qualifier === "string" ) { |
|
4936 | var filtered = jQuery.grep(elements, function( elem ) { |
|
4937 | return elem.nodeType === 1; |
|
4938 | }); |
|
4939 | ||
4940 | if ( isSimple.test( qualifier ) ) { |
|
4941 | return jQuery.filter(qualifier, filtered, !keep); |
|
4942 | } else { |
|
4943 | qualifier = jQuery.filter( qualifier, filtered ); |
|
4944 | } |
|
4945 | } |
|
4946 | ||
4947 | return jQuery.grep(elements, function( elem, i ) { |
|
4948 | return (jQuery.inArray( elem, qualifier ) >= 0) === keep; |
|
4949 | }); |
|
4950 | } |
|
4951 | ||
4952 | ||
4953 |