Skip to content

Commit 91ef69d

Browse files
committed
Widget: Don't use $.event.props when creating events.
1 parent 93214d6 commit 91ef69d

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

ui/jquery.ui.widget.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -374,29 +374,28 @@ $.Widget.prototype = {
374374
},
375375

376376
_trigger: function( type, event, data ) {
377-
var callback = this.options[ type ],
378-
args;
377+
var args, prop, orig,
378+
callback = this.options[ type ];
379379

380+
data = data || {};
380381
event = $.Event( event );
381382
event.type = ( type === this.widgetEventPrefix ?
382383
type :
383384
this.widgetEventPrefix + type ).toLowerCase();
384-
data = data || {};
385+
// the original event may come from any element
386+
// so we need to reset the target on the new event
387+
event.target = this.element[ 0 ];
385388

386389
// copy original event properties over to the new event
387-
// this would happen if we could call $.event.fix instead of $.Event
388-
// but we don't have a way to force an event to be fixed multiple times
389-
if ( event.originalEvent ) {
390-
for ( var i = $.event.props.length, prop; i; ) {
391-
prop = $.event.props[ --i ];
392-
event[ prop ] = event.originalEvent[ prop ];
390+
orig = event.originalEvent;
391+
if ( orig ) {
392+
for ( prop in orig ) {
393+
if ( !( prop in event ) ) {
394+
event[ prop ] = orig[ prop ];
395+
}
393396
}
394397
}
395398

396-
// the original event may come from any element
397-
// so we need to reset the target on the new event
398-
event.target = this.element[0];
399-
400399
this.element.trigger( event, data );
401400

402401
args = $.isArray( data ) ?

0 commit comments

Comments
 (0)