Move this.type setting to after prop set; avoid setting twice

This commit is contained in:
rwldrn 2011-04-05 16:20:55 -04:00
parent 23a411b6bc
commit b1b2e83394

View file

@ -580,7 +580,6 @@ jQuery.Event = function( src ) {
// Event object // Event object
if ( src && src.type ) { if ( src && src.type ) {
this.originalEvent = src; this.originalEvent = src;
this.type = src.type;
// Push explicitly provided properties onto the event object // Push explicitly provided properties onto the event object
for ( var prop in src ) { for ( var prop in src ) {
@ -591,6 +590,10 @@ jQuery.Event = function( src ) {
} }
} }
if ( !this.type ) {
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 ||