diff options
author | jeresig <jeresig@gmail.com> | 2010-10-10 15:36:02 -0400 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-10-10 15:36:02 -0400 |
commit | ba149e78a93afa9eab544c7defe3ccf0d412345a (patch) | |
tree | 7bb030658e820f07cb13376f5f76b4e715a89b65 /src/traversing.js | |
parent | eb67d9941694d39a592228bc6da71def3e619b94 (diff) | |
download | jquery-ba149e78a93afa9eab544c7defe3ccf0d412345a.tar.gz jquery-ba149e78a93afa9eab544c7defe3ccf0d412345a.zip |
Switch back to using Sizzle.matchesSelector.
Diffstat (limited to 'src/traversing.js')
-rw-r--r-- | src/traversing.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/traversing.js b/src/traversing.js index df431781a..c473c7583 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -6,9 +6,8 @@ var runtil = /Until$/, rmultiselector = /,/, rchild = /^\s*>/, isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice; - -var POS = jQuery.expr.match.POS; + slice = Array.prototype.slice, + POS = jQuery.expr.match.POS; jQuery.fn.extend({ find: function( selector ) { @@ -100,13 +99,13 @@ jQuery.fn.extend({ var pos = POS.test( selectors ) ? jQuery( selectors, context || this.context ) : null; - var ret = []; + ret = []; for ( var i = 0, j = this.length; i < j; i++ ) { var cur = this[i]; while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matches(selectors, cur) ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; @@ -229,7 +228,9 @@ jQuery.extend({ expr = ":not(" + expr + ")"; } - return jQuery.find.matches(expr, elems); + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { |