aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-01-09 22:14:48 +0000
committerJohn Resig <jeresig@gmail.com>2009-01-09 22:14:48 +0000
commitec7baf230d3c246dadf00c94115e6668425b9354 (patch)
tree078fc477e938993b232921b0b34e24334e41d49a
parentd12e8a34e6d96f98ac4f9408a0d61a9ed373f917 (diff)
downloadjquery-ec7baf230d3c246dadf00c94115e6668425b9354.tar.gz
jquery-ec7baf230d3c246dadf00c94115e6668425b9354.zip
Didn't get specific enough with the proxy guid, fixes #3787.
-rw-r--r--src/event.js4
-rw-r--r--test/unit/event.js17
2 files changed, 17 insertions, 4 deletions
diff --git a/src/event.js b/src/event.js
index 405e19f4d..1ba0357d2 100644
--- a/src/event.js
+++ b/src/event.js
@@ -545,7 +545,7 @@ jQuery.fn.extend({
live: function( type, fn ){
var proxy = jQuery.event.proxy( fn );
- proxy.guid += this.selector;
+ proxy.guid += this.selector + type;
jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
@@ -553,7 +553,7 @@ jQuery.fn.extend({
},
die: function( type, fn ){
- jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector } : null );
+ jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
return this;
}
});
diff --git a/test/unit/event.js b/test/unit/event.js
index cbeb9ff00..e12f3b753 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -474,7 +474,7 @@ test("toggle(Function, Function, ...)", function() {
});
test(".live()/.die()", function() {
- expect(34);
+ expect(36);
var submit = 0, div = 0, livea = 0, liveb = 0;
@@ -571,10 +571,23 @@ test(".live()/.die()", function() {
equals( called, 3, "Verify that only one click occurred." );
jQuery("#anchor2").trigger("click");
- equals( called, 3, "Verify that only one click occurred." );
+ equals( called, 3, "Verify that no click occurred." );
+
+ // Make sure that it still works if the selector is the same,
+ // but the event type is different
+ jQuery("#nothiddendiv").live("foo", callback);
// Cleanup
jQuery("#nothiddendiv").die("click", callback);
+
+ jQuery("#nothiddendiv").trigger("click");
+ equals( called, 3, "Verify that no click occurred." );
+
+ jQuery("#nothiddendiv").trigger("foo");
+ equals( called, 4, "Verify that one foo occurred." );
+
+ // Cleanup
+ jQuery("#nothiddendiv").die("foo", callback);
});
/*