mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Fix #10717, .trigger("load") on images can't bubble to window.
This means no manually triggered event named "load" can bubble, so avoid that name for delegated custom events.
This commit is contained in:
parent
2a9f0681de
commit
45101de696
@ -566,6 +566,11 @@ jQuery.event = {
|
||||
setup: jQuery.bindReady
|
||||
},
|
||||
|
||||
load: {
|
||||
// Prevent triggered image.load events from bubbling to window.load
|
||||
noBubble: true
|
||||
},
|
||||
|
||||
focus: {
|
||||
delegateType: "focusin",
|
||||
noBubble: true
|
||||
|
@ -1155,6 +1155,25 @@ test(".trigger() bubbling on disconnected elements (#10489)", function() {
|
||||
jQuery( window ).off( "click" );
|
||||
});
|
||||
|
||||
test(".trigger() doesn't bubble load event (#10717)", function() {
|
||||
expect(1);
|
||||
|
||||
jQuery( window ).on( "load", function(){
|
||||
ok( false, "load fired on window" );
|
||||
});
|
||||
|
||||
// It's not an image, but as long as it fires load...
|
||||
jQuery( '<img src="index.html" />' )
|
||||
.appendTo( "body" )
|
||||
.on( "load", function() {
|
||||
ok( true, "load fired on img" );
|
||||
})
|
||||
.trigger( "load" )
|
||||
.remove();
|
||||
|
||||
jQuery( window ).off( "load" );
|
||||
});
|
||||
|
||||
test("jQuery.Event( type, props )", function() {
|
||||
|
||||
expect(5);
|
||||
|
Loading…
Reference in New Issue
Block a user