if ( events ) {
// Unbind all events for the element
- if ( !types )
+ if ( types == undefined )
for ( var type in events )
this.remove( elem, type );
else {
data.shift();
// Handle triggering of extra function
- if ( extra ) {
+ if ( extra && jQuery.isFunction( extra ) ) {
// call the extra function and tack the current return value on the end for possible inspection
var ret = extra.apply( elem, data.concat( val ) );
// if anything is returned, give it precedence and have it overwrite the previous value
},
fix: function(event) {
+ // Short-circuit if the event has already been fixed by jQuery.event.fix
+ if ( event[ expando ] )
+ return event;
+
// store a copy of the original event object
// and clone to set read-only properties
var originalEvent = event;
event = jQuery.extend({}, originalEvent);
+ // Mark the event as fixed by jQuery.event.fix
+ event[ expando ] = true;
+
// add preventDefault and stopPropagation since
// they will not work on the clone
event.preventDefault = function() {