]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Don't use $.event.props when creating events.
authorScott González <scott.gonzalez@gmail.com>
Mon, 21 Nov 2011 16:36:58 +0000 (11:36 -0500)
committerScott González <scott.gonzalez@gmail.com>
Mon, 21 Nov 2011 16:36:58 +0000 (11:36 -0500)
(cherry picked from commit 91ef69d7503f11f2b6223b9c0061fca51e3a006f)

ui/jquery.ui.widget.js

index 7eea40e7015e7fdb2d7a6fb5aba500700a330981..d4d925e7c181401e1f4cc053679fc4cdf53e07a4 100644 (file)
@@ -239,28 +239,28 @@ $.Widget.prototype = {
        },
 
        _trigger: function( type, event, data ) {
-               var callback = this.options[ type ];
+               var prop, orig,
+                       callback = this.options[ type ];
 
+               data = data || {};
                event = $.Event( event );
                event.type = ( type === this.widgetEventPrefix ?
                        type :
                        this.widgetEventPrefix + type ).toLowerCase();
-               data = data || {};
+               // the original event may come from any element
+               // so we need to reset the target on the new event
+               event.target = this.element[ 0 ];
 
                // 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 ];
+               orig = event.originalEvent;
+               if ( orig ) {
+                       for ( prop in orig ) {
+                               if ( !( prop in event ) ) {
+                                       event[ prop ] = orig[ prop ];
+                               }
                        }
                }
 
-               // the original event may come from any element
-               // so we need to reset the target on the new event
-               event.target = this.element[0];
-
                this.element.trigger( event, data );
 
                return !( $.isFunction(callback) &&