🌐 AI搜索 & 代理 主页
Skip to content

Commit 4765bb5

Browse files
SaptakStimmywil
authored andcommitted
Filter: Use direct filter in winnow
for both simple and complex selectors Fixes gh-3272 Closes gh-3910
1 parent 625e19c commit 4765bb5

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/traversing/findFilter.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ define( [
88

99
"use strict";
1010

11-
var risSimple = /^.[^:#\[\.,]*$/;
12-
1311
// Implement the identical functionality for filter and not
1412
function winnow( elements, qualifier, not ) {
1513
if ( isFunction( qualifier ) ) {
@@ -32,16 +30,8 @@ function winnow( elements, qualifier, not ) {
3230
} );
3331
}
3432

35-
// Simple selector that can be filtered directly, removing non-Elements
36-
if ( risSimple.test( qualifier ) ) {
37-
return jQuery.filter( qualifier, elements, not );
38-
}
39-
40-
// Complex selector, compare the two sets, removing non-Elements
41-
qualifier = jQuery.filter( qualifier, elements );
42-
return jQuery.grep( elements, function( elem ) {
43-
return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
44-
} );
33+
// Filtered directly for both simple and complex selectors
34+
return jQuery.filter( qualifier, elements, not );
4535
}
4636

4737
jQuery.filter = function( expr, elems, not ) {

0 commit comments

Comments
 (0)