diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2011-04-11 13:25:57 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2011-04-11 13:25:57 -0400 |
commit | 7fa6de0ec16df46b90a862778e16c4091198870d (patch) | |
tree | 90c12fab805afb0b5a7db3bef703293dbc6d5471 | |
parent | a5071d49ba29ba115954845db9363aa6459f1a84 (diff) | |
parent | 094c48e0c5cff8f7cc039426a34ed47b2a748c3c (diff) | |
download | jquery-7fa6de0ec16df46b90a862778e16c4091198870d.tar.gz jquery-7fa6de0ec16df46b90a862778e16c4091198870d.zip |
Merge branch 'master' of github.com:jquery/jquery into fix-8790-quick-trigger
-rw-r--r-- | src/event.js | 8 | ||||
-rw-r--r-- | test/unit/event.js | 21 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/event.js b/src/event.js index 097bc6501..b8a2e37ec 100644 --- a/src/event.js +++ b/src/event.js @@ -1049,6 +1049,14 @@ jQuery.each(["live", "die"], function( i, name ) { return this; } + if ( name === "die" && !types && + origSelector && origSelector[0] === "." ) { + + context.unbind( origSelector ); + + return this; + } + if ( data === false || jQuery.isFunction( data ) ) { fn = data || returnFalse; data = undefined; diff --git a/test/unit/event.js b/test/unit/event.js index cefdf5833..b1fd919f5 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2022,6 +2022,27 @@ test("delegate with submit", function() { jQuery(document).undelegate(); }); +test("undelegate() with only namespaces", function(){ + expect(2); + + var $delegate = jQuery("#liveHandlerOrder"), + count = 0; + + $delegate.delegate("a", "click.ns", function(e) { + count++; + }); + + jQuery("a", $delegate).eq(0).trigger("click.ns"); + + equals( count, 1, "delegated click.ns"); + + $delegate.undelegate(".ns"); + + jQuery("a", $delegate).eq(1).trigger("click.ns"); + + equals( count, 1, "no more .ns after undelegate"); +}); + test("Non DOM element events", function() { expect(1); |