aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorMichael DellaNoce <mdellanoce@mailtrust.com>2011-02-01 06:57:48 -0500
committerScott González <scott.gonzalez@gmail.com>2011-02-01 06:57:48 -0500
commitb3fcf174716203013e9844f1aee3216f971fcd43 (patch)
tree32aeb79ac8b9de60ddfc9bf6b731c0270d00f353 /ui
parentcb8f5b7f2679ab5473229cac432f28c72521048c (diff)
downloadjquery-ui-b3fcf174716203013e9844f1aee3216f971fcd43.tar.gz
jquery-ui-b3fcf174716203013e9844f1aee3216f971fcd43.zip
Widget: Modified _trigger to invoke callbacks with apply so that handlers are invoked the same way .trigger() invokes them. Fixes #6795 - Widget: _trigger passes array arguments to handlers inconsistently.
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.widget.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index c8e5348ac..1ec934469 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -289,7 +289,8 @@ $.Widget.prototype = {
},
_trigger: function( type, event, data ) {
- var callback = this.options[ type ];
+ var callback = this.options[ type ],
+ args;
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
@@ -309,8 +310,12 @@ $.Widget.prototype = {
this.element.trigger( event, data );
- return !( $.isFunction(callback) &&
- callback.call( this.element[0], event, data ) === false ||
+ args = $.isArray( data ) ?
+ [ event ].concat( data ) :
+ [ event, data ];
+
+ return !( $.isFunction( callback ) &&
+ callback.apply( this.element[0], args ) === false ||
event.isDefaultPrevented() );
}
};