Created
April 18, 2011 20:01
-
-
Save jcsrb/926051 to your computer and use it in GitHub Desktop.
This file contains 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
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding | |
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html | |
jQuery.Event.prototype = { | |
preventDefault: function() { | |
this.isDefaultPrevented = returnTrue; | |
var e = this.originalEvent; | |
if ( !e ) { | |
return; | |
} | |
// if preventDefault exists run it on the original event | |
if ( e.preventDefault ) { | |
e.preventDefault(); | |
// otherwise set the returnValue property of the original event to false (IE) | |
} else { | |
e.returnValue = false; | |
} | |
}, | |
stopPropagation: function() { | |
this.isPropagationStopped = returnTrue; | |
var e = this.originalEvent; | |
if ( !e ) { | |
return; | |
} | |
// if stopPropagation exists run it on the original event | |
if ( e.stopPropagation ) { | |
e.stopPropagation(); | |
} | |
// otherwise set the cancelBubble property of the original event to true (IE) | |
e.cancelBubble = true; | |
}, | |
stopImmediatePropagation: function() { | |
this.isImmediatePropagationStopped = returnTrue; | |
this.stopPropagation(); | |
}, | |
isDefaultPrevented: returnFalse, | |
isPropagationStopped: returnFalse, | |
isImmediatePropagationStopped: returnFalse | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment