aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-01-21 08:45:41 -0500
committerScott González <scott.gonzalez@gmail.com>2012-01-21 08:45:41 -0500
commitda89fcbc07f236d43e6a1edd98603beea6e245b6 (patch)
tree7e73b10ce5eb3e58fa991dccfc50dd4212cdd76d
parent0cf6bc042938a11abc09ed4e575c8792585607ac (diff)
downloadjquery-ui-da89fcbc07f236d43e6a1edd98603beea6e245b6.tar.gz
jquery-ui-da89fcbc07f236d43e6a1edd98603beea6e245b6.zip
Widget: Added _getCreateEventData(). Fixes #8045 - Widget: Ability to provide event data for create event.
-rw-r--r--tests/unit/widget/widget_core.js15
-rw-r--r--ui/jquery.ui.widget.js3
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 2e55ad703..df83abe91 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -261,6 +261,21 @@ test( "._getCreateOptions()", function() {
$( "<div>" ).testWidget({ option2: "value2" });
});
+test( "._getCreateEventData()", function() {
+ expect( 1 );
+ var data = { foo: "bar" };
+ $.widget( "ui.testWidget", {
+ _getCreateEventData: function() {
+ return data;
+ }
+ });
+ $( "<div>" ).testWidget({
+ create: function( event, ui ) {
+ strictEqual( ui, data, "event data" );
+ }
+ });
+});
+
test( "re-init", function() {
var div = $( "<div>" ),
actions = [];
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 5c8560bfd..ad03e6f44 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -204,10 +204,11 @@ $.Widget.prototype = {
}
this._create();
- this._trigger( "create" );
+ this._trigger( "create", null, this._getCreateEventData() );
this._init();
},
_getCreateOptions: $.noop,
+ _getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,