aboutsummaryrefslogtreecommitdiffstats
path: root/src/traversing.js
diff options
context:
space:
mode:
authorTimmy Willison <tim.willison@thisismedium.com>2011-01-24 16:18:19 -0500
committerTimmy Willison <tim.willison@thisismedium.com>2011-01-24 16:18:19 -0500
commited48787ec58c12917faf47e3b95e043b2b6ded10 (patch)
tree95f0491474c9bd2ca62374e2c4181ee0192ce364 /src/traversing.js
parent6c18a1becb59f1b2e64a4920967dc5cecdb296f6 (diff)
downloadjquery-ed48787ec58c12917faf47e3b95e043b2b6ded10.tar.gz
jquery-ed48787ec58c12917faf47e3b95e043b2b6ded10.zip
Fix bug #2773, jQuery.fn.is to accept JQuery and node objects, and a small fix for winnow getting an undefined selector
Diffstat (limited to 'src/traversing.js')
-rw-r--r--src/traversing.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/traversing.js b/src/traversing.js
index 90601df55..f8d08fa9a 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -60,7 +60,8 @@ jQuery.fn.extend({
},
is: function( selector ) {
- return !!selector && jQuery.filter( selector, this ).length > 0;
+ return !!selector && (typeof selector === "string" ? jQuery.filter( selector, this ).length > 0 :
+ this.filter( selector ).length > 0);
},
closest: function( selectors, context ) {
@@ -286,7 +287,7 @@ function winnow( elements, qualifier, keep ) {
return retVal === keep;
});
- } else if ( qualifier.nodeType ) {
+ } else if ( qualifier && qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return (elem === qualifier) === keep;
});