summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-11-21 11:36:58 -0500
committerScott González <scott.gonzalez@gmail.com>2011-11-21 11:36:58 -0500
commit56422bdef52b5ed8c009135a5498f5d79c41480a (patch)
treee2845d32088c7ca50425c1dc2a6225b31dab6cf5
parent4bff6f564b132c70950c0a4100301a49bd802717 (diff)
downloadjquery-ui-56422bdef52b5ed8c009135a5498f5d79c41480a.tar.gz
jquery-ui-56422bdef52b5ed8c009135a5498f5d79c41480a.zip
Widget: Don't use $.event.props when creating events.
(cherry picked from commit 91ef69d7503f11f2b6223b9c0061fca51e3a006f)
-rw-r--r--ui/jquery.ui.widget.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 7eea40e70..d4d925e7c 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -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) &&