Commit 8c91da57 authored by Dave Methvin's avatar Dave Methvin Committed by timmywil

Fix #9593. Create a new jQuery.Event rather than a plain object when...

Fix #9593. Create a new jQuery.Event rather than a plain object when simulate()ing events. Fix a related issue with not passing src to jQuery.Event constructor.
parent 619a89d5
...@@ -644,7 +644,7 @@ jQuery.Event = function( src, props ) { ...@@ -644,7 +644,7 @@ jQuery.Event = function( src, props ) {
} }
// Create a timestamp if incoming event doesn't have one // Create a timestamp if incoming event doesn't have one
this.timeStamp = src.timeStamp || jQuery.now(); this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed // Mark it as fixed
this[ jQuery.expando ] = true; this[ jQuery.expando ] = true;
...@@ -875,7 +875,7 @@ function simulate( type, elem, event, bubble ) { ...@@ -875,7 +875,7 @@ function simulate( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one. // Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the // Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor. // simulated event prevents default then we do the same on the donor.
var e = jQuery.extend( {}, event, { type: type, originalEvent: {} } ); var e = jQuery.extend( new jQuery.Event(), event, { type: type, originalEvent: {} } );
if ( bubble ) { if ( bubble ) {
jQuery.event.trigger( e, null, elem ); jQuery.event.trigger( e, null, elem );
} else { } else {
......
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