Last active
August 29, 2015 14:21
-
-
Save gabrielschulhof/b09c9e34bfc0904916ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/event.js b/src/event.js | |
index 584ba90..ea70d0e 100644 | |
--- a/src/event.js | |
+++ b/src/event.js | |
@@ -610,10 +610,13 @@ jQuery.event = { | |
event, | |
{ | |
type: type, | |
- isSimulated: true, | |
- originalEvent: {} | |
+ isSimulated: true | |
} | |
); | |
+ | |
+ // @markelog is this what you're talking about? | |
+ event.originalEvent.isSimulated = true; | |
+ | |
if ( bubble ) { | |
jQuery.event.trigger( e, null, elem ); | |
} else { | |
@@ -622,6 +625,10 @@ jQuery.event = { | |
if ( e.isDefaultPrevented() ) { | |
event.preventDefault(); | |
} | |
+ | |
+ // @markelog If that's what you're talking about then this is what I mean by needing to | |
+ // restore the original event after we're done processing the simulated event. | |
+ delete event.originalEvent.isSimulated; | |
} | |
}; | |
@@ -681,6 +688,10 @@ jQuery.Event.prototype = { | |
preventDefault: function() { | |
var e = this.originalEvent; | |
+ if ( this.isSimulated ) { | |
+ return; | |
+ } | |
+ | |
this.isDefaultPrevented = returnTrue; | |
if ( e ) { | |
@@ -690,6 +701,10 @@ jQuery.Event.prototype = { | |
stopPropagation: function() { | |
var e = this.originalEvent; | |
+ if ( this.isSimulated ) { | |
+ return; | |
+ } | |
+ | |
this.isPropagationStopped = returnTrue; | |
if ( e ) { | |
@@ -699,6 +714,10 @@ jQuery.Event.prototype = { | |
stopImmediatePropagation: function() { | |
var e = this.originalEvent; | |
+ if ( this.isSimulated ) { | |
+ return; | |
+ } | |
+ | |
this.isImmediatePropagationStopped = returnTrue; | |
if ( e ) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment