Ticket #8753 Always set event type explicitly

This commit is contained in:
Rick Waldon 2011-04-11 11:32:23 -04:00
parent 6591f6dd9d
commit 868e1e28ce

View file

@ -304,7 +304,7 @@ jQuery.event = {
} }
event.namespace = namespaces.join("."); event.namespace = namespaces.join(".");
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
// Handle a global trigger // Handle a global trigger
if ( !elem ) { if ( !elem ) {
// Don't bubble custom events when global (to avoid too much overhead) // Don't bubble custom events when global (to avoid too much overhead)
@ -574,6 +574,9 @@ jQuery.Event = function( src ) {
} }
} }
// Always ensure a type has been explicitly set
this.type = src.type;
// Events bubbling up the document may have been marked as prevented // Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value. // by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
@ -1033,7 +1036,7 @@ jQuery.each(["live", "die"], function( i, name ) {
if ( data === false || jQuery.isFunction( data ) ) { if ( data === false || jQuery.isFunction( data ) ) {
fn = data || returnFalse; fn = data || returnFalse;
data = undefined; data = undefined;
} }
types = (types || "").split(" "); types = (types || "").split(" ");