aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2007-01-07 22:29:15 +0000
committerJohn Resig <jeresig@gmail.com>2007-01-07 22:29:15 +0000
commit33662cd713c28b2db0adccec170ffe93b35f098a (patch)
tree04746023787b157f7447a16e63c455751c1bde92
parent0798c6e64e4e0c984d5ece50ade61827c2105c39 (diff)
downloadjquery-33662cd713c28b2db0adccec170ffe93b35f098a.tar.gz
jquery-33662cd713c28b2db0adccec170ffe93b35f098a.zip
Fixed problem with $("div",$("body")) breaking (returning an array, of length one, containing undefined).
-rw-r--r--src/jquery/jquery.js2
-rw-r--r--src/selector/selector.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index e566cb671..04b9ca5c1 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -1579,7 +1579,7 @@ jQuery.extend({
}
}
- var r = [ result[0] ];
+ var r = result.length ? [ result[0] ] : [];
check: for ( var i = 1, rl = result.length; i < rl; i++ ) {
for ( var j = 0; j < i; j++ )
diff --git a/src/selector/selector.js b/src/selector/selector.js
index 4633c3094..7f71e2e34 100644
--- a/src/selector/selector.js
+++ b/src/selector/selector.js
@@ -101,7 +101,7 @@ jQuery.extend({
return [ t ];
// Make sure that the context is a DOM Element
- if ( context && context.nodeType == undefined )
+ if ( context && !context.nodeType )
context = null;
// Set the correct context (if none is provided)
@@ -423,4 +423,4 @@ jQuery.extend({
return r;
}
-}); \ No newline at end of file
+});