diff --git a/src/event.js b/src/event.js index 7d0c516f5..ea2bfa982 100644 --- a/src/event.js +++ b/src/event.js @@ -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 diff --git a/test/unit/event.js b/test/unit/event.js index 93049003a..3af8a3fde 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -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( '' ) + .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);