function winnow( elements, qualifier, keep ) {

  // Can't pass null or undefined to indexOf in Firefox 4
  // Set to 0 to skip string check
  qualifier = qualifier || 0;

  if ( jQuery.isFunction( qualifier ) ) {
    return jQuery.grep(elements, function( elem, i ) {
      var retVal = !!qualifier.call( elem, i, elem );
      return retVal === keep;
    });

  } else if ( qualifier.nodeType ) {
    return jQuery.grep(elements, function( elem, i ) {
      return (elem === qualifier) === keep;
    });

  } else if ( typeof qualifier === "string" ) {
    var filtered = jQuery.grep(elements, function( elem ) {
      return elem.nodeType === 1;
    });

    if ( isSimple.test( qualifier ) ) {
      return jQuery.filter(qualifier, filtered, !keep);
    } else {
      qualifier = jQuery.filter( qualifier, filtered );
    }
  }

  return jQuery.grep(elements, function( elem, i ) {
    return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
  });
}
// Implement the identical functionality for filter and not
Implement the identical functionality for filter and not
Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
  qualifier = qualifier || 0;
  if ( jQuery.isFunction( qualifier ) ) {
    return jQuery.grep(elements, function( elem, i ) {
      var retVal = !!qualifier.call( elem, i, elem );
      return retVal === keep;
    });
  } else if ( qualifier.nodeType ) {
    return jQuery.grep(elements, function( elem, i ) {
      return (elem === qualifier) === keep;
    });
  } else if ( typeof qualifier === "string" ) {
    var filtered = jQuery.grep(elements, function( elem ) {
      return elem.nodeType === 1;
    });
    if ( isSimple.test( qualifier ) ) {
      return jQuery.filter(qualifier, filtered, !keep);
    } else {
      qualifier = jQuery.filter( qualifier, filtered );
    }
  }
  return jQuery.grep(elements, function( elem, i ) {
    return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
  });
}
function winnow ( elements , qualifier , keep ) { qualifier = qualifier || 0 ; if ( jQuery . isFunction ( qualifier ) ) { return jQuery . grep ( elements , function ( elem , i ) { var retVal = ! ! qualifier . call ( elem , i , elem ) ; return retVal === keep ; } ) ; } else if ( qualifier . nodeType ) { return jQuery . grep ( elements , function ( elem , i ) { return ( elem === qualifier ) === keep ; } ) ; } else if ( typeof qualifier === "string" ) { var filtered = jQuery . grep ( elements , function ( elem ) { return elem . nodeType === 1 ; } ) ; if ( isSimple . test ( qualifier ) ) { return jQuery . filter ( qualifier , filtered , ! keep ) ; } else { qualifier = jQuery . filter ( qualifier , filtered ) ; } } return jQuery . grep ( elements , function ( elem , i ) { return ( jQuery . inArray ( elem , qualifier ) >= 0 ) === keep ; } ) ; }
Implement the identical functionality for filter and not
Implement the identical functionality for filter and not
// Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check