diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-01-09 14:28:39 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-01-09 14:28:39 +0000 |
commit | 142fddbf85a2903ec745afc4c5d7e85da3c9de7a (patch) | |
tree | 731d8f5b5097b9f8d9837b661ab73bc3ec362652 /ui/ui.core.js | |
parent | a6471b1705bb39eb8311741d309539f5101b6f78 (diff) | |
download | jquery-ui-142fddbf85a2903ec745afc4c5d7e85da3c9de7a.tar.gz jquery-ui-142fddbf85a2903ec745afc4c5d7e85da3c9de7a.zip |
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().
Diffstat (limited to 'ui/ui.core.js')
-rw-r--r-- | ui/ui.core.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js index d5949c30d..03bb59849 100644 --- a/ui/ui.core.js +++ b/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; } }; |