mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Don't run direct handlers if delegate did .stopPropagation().
This commit is contained in:
@@ -2054,6 +2054,22 @@ test(".delegate()/.undelegate()", function() {
|
||||
jQuery("#body").undelegate("#nothiddendiv div", "click");
|
||||
});
|
||||
|
||||
test("stopPropagation() stops directly-bound events on delegated target", function() {
|
||||
expect(1);
|
||||
|
||||
var markup = jQuery( '<div><p><a href="#">target</a></p></div>' );
|
||||
markup
|
||||
.on( "click", function() {
|
||||
ok( false, "directly-bound event on delegate target was called" );
|
||||
})
|
||||
.on( "click", "a", function( e ) {
|
||||
e.stopPropagation();
|
||||
ok( true, "delegated handler was called" );
|
||||
})
|
||||
.find("a").click().end()
|
||||
.remove();
|
||||
});
|
||||
|
||||
test("undelegate all bound events", function(){
|
||||
expect(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user