Event: remove preDispatch hook & simplify "simulate" signature

Ref 3655c4e190
This commit is contained in:
Oleg Gaidarenko 2015-06-05 22:21:26 +03:00
parent e847574fc7
commit 05e54ce798

View File

@ -648,8 +648,8 @@ jQuery.event = {
} }
}, },
// Piggyback on a donor event to simulate a different one // Piggyback on a donor event to simulate a diff ne
simulate: function( type, elem, event, bubble ) { simulate: function( type, elem, event ) {
var e = jQuery.extend( var e = jQuery.extend(
new jQuery.Event(), new jQuery.Event(),
event, event,
@ -666,11 +666,9 @@ jQuery.event = {
// constancy with other events and for more focused logic // constancy with other events and for more focused logic
} }
); );
if ( bubble ) {
jQuery.event.trigger( e, null, elem ); jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) { if ( e.isDefaultPrevented() ) {
event.preventDefault(); event.preventDefault();
} }
@ -866,7 +864,7 @@ if ( !support.submit ) {
if ( event._submitBubble ) { if ( event._submitBubble ) {
delete event._submitBubble; delete event._submitBubble;
if ( this.parentNode && !event.isTrigger ) { if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true ); jQuery.event.simulate( "submit", this.parentNode, event );
} }
} }
}, },
@ -905,7 +903,7 @@ if ( !support.change ) {
this._justChanged = false; this._justChanged = false;
} }
// Allow triggered, simulated change events (#11500) // Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true ); jQuery.event.simulate( "change", this, event );
}); });
} }
return false; return false;
@ -917,7 +915,7 @@ if ( !support.change ) {
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) { if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) {
jQuery.event.add( elem, "change._change", function( event ) { jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true ); jQuery.event.simulate( "change", this.parentNode, event );
} }
}); });
jQuery._data( elem, "change", true ); jQuery._data( elem, "change", true );
@ -957,7 +955,7 @@ if ( !support.focusin ) {
// Attach a single capturing handler on the document while someone wants focusin/focusout // Attach a single capturing handler on the document while someone wants focusin/focusout
var handler = function( event ) { var handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
}; };
jQuery.event.special[ fix ] = { jQuery.event.special[ fix ] = {