Skip to content

Commit 56422bd

Browse files
committed
Widget: Don't use $.event.props when creating events.
(cherry picked from commit 91ef69d)
1 parent 4bff6f5 commit 56422bd

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

ui/jquery.ui.widget.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -239,28 +239,28 @@ $.Widget.prototype = {
239239
},
240240

241241
_trigger: function( type, event, data ) {
242-
var callback = this.options[ type ];
242+
var prop, orig,
243+
callback = this.options[ type ];
243244

245+
data = data || {};
244246
event = $.Event( event );
245247
event.type = ( type === this.widgetEventPrefix ?
246248
type :
247249
this.widgetEventPrefix + type ).toLowerCase();
248-
data = data || {};
250+
// the original event may come from any element
251+
// so we need to reset the target on the new event
252+
event.target = this.element[ 0 ];
249253

250254
// copy original event properties over to the new event
251-
// this would happen if we could call $.event.fix instead of $.Event
252-
// but we don't have a way to force an event to be fixed multiple times
253-
if ( event.originalEvent ) {
254-
for ( var i = $.event.props.length, prop; i; ) {
255-
prop = $.event.props[ --i ];
256-
event[ prop ] = event.originalEvent[ prop ];
255+
orig = event.originalEvent;
256+
if ( orig ) {
257+
for ( prop in orig ) {
258+
if ( !( prop in event ) ) {
259+
event[ prop ] = orig[ prop ];
260+
}
257261
}
258262
}
259263

260-
// the original event may come from any element
261-
// so we need to reset the target on the new event
262-
event.target = this.element[0];
263-
264264
this.element.trigger( event, data );
265265

266266
return !( $.isFunction(callback) &&

0 commit comments

Comments
 (0)