Skip to content

Commit

Permalink
Merge branch '8777' of https://github.com/rwldrn/jquery into rwldrn-8777
Browse files Browse the repository at this point in the history
Conflicts:
	src/event.js
  • Loading branch information
jeresig committed Apr 11, 2011
2 parents 868e1e2 + 4b0c26f commit 094c48e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/event.js
Expand Up @@ -1033,6 +1033,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;
Expand Down
21 changes: 21 additions & 0 deletions test/unit/event.js
Expand Up @@ -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);

Expand Down

0 comments on commit 094c48e

Please sign in to comment.