diff options
author | Saptak Sengupta <saptak013@gmail.com> | 2018-01-10 11:04:31 +0530 |
---|---|---|
committer | Timmy Willison <4timmywil@gmail.com> | 2018-01-17 11:01:08 -0500 |
commit | 4765bb5c7840fc5f725f5bda38afcebc3730fbfc (patch) | |
tree | 06dacae931e5b8f31d9d1d2ac521fb63b55ccb28 | |
parent | 625e19cd9be4898939a7c40dbeb2b17e40df9d54 (diff) | |
download | jquery-4765bb5c7840fc5f725f5bda38afcebc3730fbfc.tar.gz jquery-4765bb5c7840fc5f725f5bda38afcebc3730fbfc.zip |
Filter: Use direct filter in winnow
for both simple and complex selectors
Fixes gh-3272
Closes gh-3910
-rw-r--r-- | src/traversing/findFilter.js | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/traversing/findFilter.js b/src/traversing/findFilter.js index 023a2cefb..268dad796 100644 --- a/src/traversing/findFilter.js +++ b/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 ) { |