Skip to content
Permalink
Browse files

Widget factory: _trigger will now set event.result if the callback re…

…turns a value. The created event is now always run through $.Event to reset isDefaultPrevent(), isPropagationStopped(), isImmediatePropagationStopped().
  • Loading branch information...
scottgonzalez committed Jan 9, 2009
1 parent a6471b1 commit 142fddbf85a2903ec745afc4c5d7e85da3c9de7a
Showing with 11 additions and 4 deletions.
  1. +11 −4 ui/ui.core.js
@@ -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;
}
};

0 comments on commit 142fddb

Please sign in to comment.
You can’t perform that action at this time.