Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix #13797: .is with single-node context
(cherry picked from commit 4f786ba)
- Loading branch information
Showing
2 changed files
with
28 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -58,14 +58,16 @@ jQuery.fn.extend({ | ||
}, | ||
|
||
is: function( selector ) { | ||
return !!selector && ( | ||
typeof selector === "string" ? | ||
// If this is a positional/relative selector, check membership in the returned set | ||
// so $("p:first").is("p:last") won't return true for a doc with two "p". | ||
rneedsContext.test( selector ) ? | ||
jQuery( selector, this.context ).index( this[ 0 ] ) >= 0 : | ||
jQuery.filter( selector, this ).length > 0 : | ||
this.filter( selector ).length > 0 ); | ||
return !!winnow( | ||
this, | ||
|
||
// If this is a positional/relative selector, check membership in the returned set | ||
// so $("p:first").is("p:last") won't return true for a doc with two "p". | ||
typeof selector === "string" && rneedsContext.test( selector ) ? | ||
jQuery( selector ) : | ||
selector || [], | ||
false | ||
).length; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gibson042
Author
Member
|
||
}, | ||
|
||
closest: function( selectors, context ) { | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I suspect we don't have any tests for the iframe use cases? How will this affect seamless iframe use cases?
http://jsfiddle.net/rwaldron/8nHRk/