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";
|
"use strict";
|
||||||
|
|
||||||
var risSimple = /^.[^:#\[\.,]*$/;
|
|
||||||
|
|
||||||
// Implement the identical functionality for filter and not
|
// Implement the identical functionality for filter and not
|
||||||
function winnow( elements, qualifier, not ) {
|
function winnow( elements, qualifier, not ) {
|
||||||
if ( isFunction( qualifier ) ) {
|
if ( isFunction( qualifier ) ) {
|
||||||
@ -32,18 +30,10 @@ function winnow( elements, qualifier, not ) {
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simple selector that can be filtered directly, removing non-Elements
|
// Filtered directly for both simple and complex selectors
|
||||||
if ( risSimple.test( qualifier ) ) {
|
|
||||||
return jQuery.filter( qualifier, elements, not );
|
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 ) {
|
jQuery.filter = function( expr, elems, not ) {
|
||||||
var elem = elems[ 0 ];
|
var elem = elems[ 0 ];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user