mirror of
https://github.com/jquery/jquery.git
synced 2026-02-08 01:45:03 -05:00
Landing pull request 491. Fix #7322. Make .is() with a positional selector work like delegated event logic. Fixes #7322.
More Details: - https://github.com/jquery/jquery/pull/491 - http://bugs.jquery.com/ticket/7322
This commit is contained in:
@@ -73,9 +73,14 @@ jQuery.fn.extend({
|
||||
},
|
||||
|
||||
is: function( selector ) {
|
||||
return !!selector && ( typeof selector === "string" ?
|
||||
jQuery.filter( selector, this ).length > 0 :
|
||||
this.filter( selector ).length > 0 );
|
||||
return !!selector && (
|
||||
typeof selector === "string" ?
|
||||
// If this is a positional selector, check membership in the returned set
|
||||
// so $("p:first").is("p:last") won't return true for a doc with two "p".
|
||||
POS.test( selector ) ?
|
||||
jQuery( selector, this.context ).index( this[0] ) >= 0 :
|
||||
jQuery.filter( selector, this ).length > 0 :
|
||||
this.filter( selector ).length > 0 );
|
||||
},
|
||||
|
||||
closest: function( selectors, context ) {
|
||||
|
||||
Reference in New Issue
Block a user