Widget: Added _getCreateEventData(). Fixes #8045 - Widget: Ability to provide event data for create event.

This commit is contained in:
Scott González 2012-01-21 08:45:41 -05:00
parent 0cf6bc0429
commit da89fcbc07
2 changed files with 17 additions and 1 deletions

View File

@ -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 = [];

View File

@ -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,