MCPcopy Create free account
hub / github.com/frank-lam/fullstack-tutorial / winnow

Function winnow

notes/docsify/unpkg/gotop/jquery-2.1.0.js:2582–2609  ·  view source on GitHub ↗
( elements, qualifier, not )

Source from the content-addressed store, hash-verified

2580
2581// Implement the identical functionality for filter and not
2582function 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
2611jQuery.filter = function( expr, elems, not ) {
2612 var elem = elems[ 0 ];

Callers 1

jquery-2.1.0.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected