mirror of
https://github.com/jquery/jquery.git
synced 2024-10-05 11:34:18 +00:00
Filter: Use direct filter in winnow
for both simple and complex selectors Fixes gh-3272 Closes gh-3910
This commit is contained in:
parent
625e19cd9b
commit
4765bb5c78
@ -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 ) ) {
|
||||
// Filtered directly for both simple and complex selectors
|
||||
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;
|
||||
} );
|
||||
}
|
||||
|
||||
jQuery.filter = function( expr, elems, not ) {
|
||||
|
Loading…
Reference in New Issue
Block a user