Commit 45101de6 authored by Dave Methvin's avatar Dave Methvin

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.
parent 2a9f0681
...@@ -566,6 +566,11 @@ jQuery.event = { ...@@ -566,6 +566,11 @@ jQuery.event = {
setup: jQuery.bindReady setup: jQuery.bindReady
}, },
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: { focus: {
delegateType: "focusin", delegateType: "focusin",
noBubble: true noBubble: true
......
...@@ -1155,6 +1155,25 @@ test(".trigger() bubbling on disconnected elements (#10489)", function() { ...@@ -1155,6 +1155,25 @@ test(".trigger() bubbling on disconnected elements (#10489)", function() {
jQuery( window ).off( "click" ); 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() { test("jQuery.Event( type, props )", function() {
expect(5); expect(5);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment