aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2007-01-23 16:58:03 +0000
committerJörn Zaefferer <joern.zaefferer@gmail.com>2007-01-23 16:58:03 +0000
commitd9464547e0c328bf9f9b67e8d38621023a7e450e (patch)
tree8d565d6394085988b343a817f2b4d5ad826330ca /src
parent5cfaef9ff9b121850f1e27afae6819023acadbf7 (diff)
downloadjquery-d9464547e0c328bf9f9b67e8d38621023a7e450e.tar.gz
jquery-d9464547e0c328bf9f9b67e8d38621023a7e450e.zip
Fix/test for #861
Diffstat (limited to 'src')
-rw-r--r--src/jquery/coreTest.js10
-rw-r--r--src/jquery/jquery.js7
2 files changed, 14 insertions, 3 deletions
diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js
index a9c3e26d1..a7b470e09 100644
--- a/src/jquery/coreTest.js
+++ b/src/jquery/coreTest.js
@@ -663,3 +663,13 @@ test("eq(), gt(), lt(), contains()", function() {
isSet( $("#ap a").lt(3).get(), q("google", "groups", "anchor1"), "lt()" );
isSet( $("#foo a").contains("log").get(), q("anchor2", "simon"), "contains()" );
});
+
+test("click() context", function() {
+ $('<li><a href="#">Change location</a></li>').prependTo('#firstUL').find('a').bind('click', function() {
+ var close = $('spanx', this); // same with $(this).find('span');
+ ok( close.length == 0, "Element does not exist, length must be zero" );
+ ok( !close[0], "Element does not exist, direct access to element must return undefined" );
+ //console.log( close[0]); // it's the <a> and not a <span> element
+ return false;
+ }).click();
+}); \ No newline at end of file
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index d9f5b8a64..b72095433 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -257,9 +257,10 @@ jQuery.fn = jQuery.prototype = {
* @cat Core
*/
pushStack: function( a ) {
- var ret = jQuery(this);
+ var ret = jQuery(a);
ret.prevObject = this;
- return ret.setArray( a );
+ //return ret.setArray( a );
+ return ret;
},
/**
@@ -803,7 +804,7 @@ jQuery.fn = jQuery.prototype = {
find: function(t) {
return this.pushStack( jQuery.map( this, function(a){
return jQuery.find(t,a);
- }) );
+ }), t );
},
/**