Ticket #8777 undelegate by namespace
This commit is contained in:
parent
2ed81b44be
commit
4b0c26f0af
|
@ -1027,6 +1027,14 @@ jQuery.each(["live", "die"], function( i, name ) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( name === "die" && !types &&
|
||||||
|
origSelector && origSelector[0] === "." ) {
|
||||||
|
|
||||||
|
context.unbind( origSelector );
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if ( jQuery.isFunction( data ) ) {
|
if ( jQuery.isFunction( data ) ) {
|
||||||
fn = data;
|
fn = data;
|
||||||
data = undefined;
|
data = undefined;
|
||||||
|
@ -1184,3 +1192,4 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
|
||||||
});
|
});
|
||||||
|
|
||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
|
||||||
|
|
|
@ -1956,6 +1956,27 @@ test("delegate with submit", function() {
|
||||||
jQuery(document).undelegate();
|
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() {
|
test("Non DOM element events", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
|
|
||||||
|
@ -2027,3 +2048,4 @@ test("event properties", function() {
|
||||||
}).click();
|
}).click();
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue