| 2580 | |
| 2581 | // Implement the identical functionality for filter and not |
| 2582 | function winnow( elements, qualifier, not ) { |
| 2583 | if ( jQuery.isFunction( qualifier ) ) { |
| 2584 | return jQuery.grep( elements, function( elem, i ) { |
| 2585 | /* jshint -W018 */ |
| 2586 | return !!qualifier.call( elem, i, elem ) !== not; |
| 2587 | }); |
| 2588 | |
| 2589 | } |
| 2590 | |
| 2591 | if ( qualifier.nodeType ) { |
| 2592 | return jQuery.grep( elements, function( elem ) { |
| 2593 | return ( elem === qualifier ) !== not; |
| 2594 | }); |
| 2595 | |
| 2596 | } |
| 2597 | |
| 2598 | if ( typeof qualifier === "string" ) { |
| 2599 | if ( risSimple.test( qualifier ) ) { |
| 2600 | return jQuery.filter( qualifier, elements, not ); |
| 2601 | } |
| 2602 | |
| 2603 | qualifier = jQuery.filter( qualifier, elements ); |
| 2604 | } |
| 2605 | |
| 2606 | return jQuery.grep( elements, function( elem ) { |
| 2607 | return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; |
| 2608 | }); |
| 2609 | } |
| 2610 | |
| 2611 | jQuery.filter = function( expr, elems, not ) { |
| 2612 | var elem = elems[ 0 ]; |