mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Widget factory: _trigger will now set event.result if the callback returns a value. The created event is now always run through $.Event to reset isDefaultPrevent(), isPropagationStopped(), isImmediatePropagationStopped().
This commit is contained in:
parent
a6471b1705
commit
142fddbf85
@ -370,13 +370,20 @@ $.widget.prototype = {
|
||||
eventName = (type == this.widgetEventPrefix
|
||||
? type : this.widgetEventPrefix + type);
|
||||
|
||||
event = event ? $.event.fix(event) : $.Event();
|
||||
// event can be null, a hash, a native event, a fixed event
|
||||
event = $.Event(event);
|
||||
event.type = eventName;
|
||||
|
||||
this.element.trigger(event, data);
|
||||
|
||||
return !(callback && callback.call(this.element[0], event, data) === false
|
||||
|| event.isDefaultPrevented());
|
||||
var callbackResult = callback
|
||||
? callback.call(this.element[0], event, data)
|
||||
: undefined;
|
||||
|
||||
event.result = callbackResult !== undefined
|
||||
? callbackResult
|
||||
: event.result;
|
||||
|
||||
return event.result !== false;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user