mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Widget: Don't use $.event.props when creating events.
(cherry picked from commit 91ef69d750
)
This commit is contained in:
parent
4bff6f564b
commit
56422bdef5
28
ui/jquery.ui.widget.js
vendored
28
ui/jquery.ui.widget.js
vendored
@ -239,27 +239,27 @@ $.Widget.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_trigger: function( type, event, data ) {
|
_trigger: function( type, event, data ) {
|
||||||
var callback = this.options[ type ];
|
var prop, orig,
|
||||||
|
callback = this.options[ type ];
|
||||||
|
|
||||||
|
data = data || {};
|
||||||
event = $.Event( event );
|
event = $.Event( event );
|
||||||
event.type = ( type === this.widgetEventPrefix ?
|
event.type = ( type === this.widgetEventPrefix ?
|
||||||
type :
|
type :
|
||||||
this.widgetEventPrefix + type ).toLowerCase();
|
this.widgetEventPrefix + type ).toLowerCase();
|
||||||
data = data || {};
|
|
||||||
|
|
||||||
// copy original event properties over to the new event
|
|
||||||
// this would happen if we could call $.event.fix instead of $.Event
|
|
||||||
// but we don't have a way to force an event to be fixed multiple times
|
|
||||||
if ( event.originalEvent ) {
|
|
||||||
for ( var i = $.event.props.length, prop; i; ) {
|
|
||||||
prop = $.event.props[ --i ];
|
|
||||||
event[ prop ] = event.originalEvent[ prop ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// the original event may come from any element
|
// the original event may come from any element
|
||||||
// so we need to reset the target on the new event
|
// so we need to reset the target on the new event
|
||||||
event.target = this.element[0];
|
event.target = this.element[ 0 ];
|
||||||
|
|
||||||
|
// copy original event properties over to the new event
|
||||||
|
orig = event.originalEvent;
|
||||||
|
if ( orig ) {
|
||||||
|
for ( prop in orig ) {
|
||||||
|
if ( !( prop in event ) ) {
|
||||||
|
event[ prop ] = orig[ prop ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.element.trigger( event, data );
|
this.element.trigger( event, data );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user