MCPcopy Create free account
hub / github.com/JsAaron/jQuery / winnow

Function winnow

2.1.1/test/other.js:11–38  ·  view source on GitHub ↗
( elements, qualifier, not )

Source from the content-addressed store, hash-verified

9
10// Implement the identical functionality for filter and not
11function winnow( elements, qualifier, not ) {
12 if ( jQuery.isFunction( qualifier ) ) {
13 return jQuery.grep( elements, function( elem, i ) {
14 /* jshint -W018 */
15 return !!qualifier.call( elem, i, elem ) !== not;
16 });
17
18 }
19
20 if ( qualifier.nodeType ) {
21 return jQuery.grep( elements, function( elem ) {
22 return ( elem === qualifier ) !== not;
23 });
24
25 }
26
27 if ( typeof qualifier === "string" ) {
28 if ( risSimple.test( qualifier ) ) {
29 return jQuery.filter( qualifier, elements, not );
30 }
31
32 qualifier = jQuery.filter( qualifier, elements );
33 }
34
35 return jQuery.grep( elements, function( elem ) {
36 return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
37 });
38}
39
40jQuery.filter = function( expr, elems, not ) {
41 var elem = elems[ 0 ];

Callers 1

other.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected