This is a follow-up to similar changes to data & event storages from
gh-4603.
Closes gh-5235
Ref gh-4603
new jQuery.Event( originalEvent );
},
- special: {
+ special: jQuery.extend( Object.create( null ), {
load: {
// Prevent triggered image.load events from bubbling to window.load
}
}
}
- }
+ } )
};
// Ensure the presence of an event listener that handles manually-triggered
.trigger( "click" ); // 0
} );
+QUnit.test( "special interference with Object.prototype", function( assert ) {
+ assert.expect( 1 );
+
+ var triggered = false;
+
+ Object.prototype.jqfake = {
+ trigger: function() {
+ triggered = true;
+ }
+ };
+
+ jQuery( "<div></div>" )
+ .appendTo( "#qunit-fixture" )
+ .trigger( "jqfake" );
+
+ delete Object.prototype.jqfake;
+
+ assert.ok( !triggered, "Object.prototype.jqfake.trigger not called" );
+} );
+
QUnit.test( ".on( event-map, null-selector, data ) trac-11130", function( assert ) {
assert.expect( 1 );