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:
Scott González 2009-01-09 14:28:39 +00:00
parent a6471b1705
commit 142fddbf85

View File

@ -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;
}
};