| 2724 | |
| 2725 | // Implement the identical functionality for filter and not |
| 2726 | function winnow( elements, qualifier, not ) { |
| 2727 | if ( jQuery.isFunction( qualifier ) ) { |
| 2728 | return jQuery.grep( elements, function( elem, i ) { |
| 2729 | /* jshint -W018 */ |
| 2730 | return !!qualifier.call( elem, i, elem ) !== not; |
| 2731 | } ); |
| 2732 | |
| 2733 | } |
| 2734 | |
| 2735 | if ( qualifier.nodeType ) { |
| 2736 | return jQuery.grep( elements, function( elem ) { |
| 2737 | return ( elem === qualifier ) !== not; |
| 2738 | } ); |
| 2739 | |
| 2740 | } |
| 2741 | |
| 2742 | if ( typeof qualifier === "string" ) { |
| 2743 | if ( risSimple.test( qualifier ) ) { |
| 2744 | return jQuery.filter( qualifier, elements, not ); |
| 2745 | } |
| 2746 | |
| 2747 | qualifier = jQuery.filter( qualifier, elements ); |
| 2748 | } |
| 2749 | |
| 2750 | return jQuery.grep( elements, function( elem ) { |
| 2751 | return ( indexOf.call( qualifier, elem ) > -1 ) !== not; |
| 2752 | } ); |
| 2753 | } |
| 2754 | |
| 2755 | jQuery.filter = function( expr, elems, not ) { |
| 2756 | var elem = elems[ 0 ]; |