| 2604 | |
| 2605 | // Implement the identical functionality for filter and not |
| 2606 | function winnow( elements, qualifier, not ) { |
| 2607 | if ( jQuery.isFunction( qualifier ) ) { |
| 2608 | return jQuery.grep( elements, function( elem, i ) { |
| 2609 | /* jshint -W018 */ |
| 2610 | return !!qualifier.call( elem, i, elem ) !== not; |
| 2611 | }); |
| 2612 | |
| 2613 | } |
| 2614 | |
| 2615 | if ( qualifier.nodeType ) { |
| 2616 | return jQuery.grep( elements, function( elem ) { |
| 2617 | return ( elem === qualifier ) !== not; |
| 2618 | }); |
| 2619 | |
| 2620 | } |
| 2621 | |
| 2622 | if ( typeof qualifier === "string" ) { |
| 2623 | if ( risSimple.test( qualifier ) ) { |
| 2624 | return jQuery.filter( qualifier, elements, not ); |
| 2625 | } |
| 2626 | |
| 2627 | qualifier = jQuery.filter( qualifier, elements ); |
| 2628 | } |
| 2629 | |
| 2630 | return jQuery.grep( elements, function( elem ) { |
| 2631 | return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; |
| 2632 | }); |
| 2633 | } |
| 2634 | |
| 2635 | jQuery.filter = function( expr, elems, not ) { |
| 2636 | var elem = elems[ 0 ]; |