Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Filter: Use direct filter in winnow
- Loading branch information
Showing
with
2 additions
and
12 deletions.
-
+2
−12
src/traversing/findFilter.js
|
@@ -8,8 +8,6 @@ define( [ |
|
|
|
|
|
"use strict"; |
|
|
|
|
|
var risSimple = /^.[^:#\[\.,]*$/; |
|
|
|
|
|
// Implement the identical functionality for filter and not |
|
|
function winnow( elements, qualifier, not ) { |
|
|
if ( isFunction( qualifier ) ) { |
|
@@ -32,16 +30,8 @@ function winnow( elements, qualifier, not ) { |
|
|
} ); |
|
|
} |
|
|
|
|
|
// Simple selector that can be filtered directly, removing non-Elements |
|
|
if ( risSimple.test( qualifier ) ) { |
|
|
return jQuery.filter( qualifier, elements, not ); |
|
|
} |
|
|
|
|
|
// Complex selector, compare the two sets, removing non-Elements |
|
|
qualifier = jQuery.filter( qualifier, elements ); |
|
|
return jQuery.grep( elements, function( elem ) { |
|
|
return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; |
|
|
} ); |
|
|
// Filtered directly for both simple and complex selectors |
|
|
return jQuery.filter( qualifier, elements, not ); |
|
|
} |
|
|
|
|
|
jQuery.filter = function( expr, elems, not ) { |
|
|