mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Widget: Added _getCreateEventData(). Fixes #8045 - Widget: Ability to provide event data for create event.
This commit is contained in:
parent
0cf6bc0429
commit
da89fcbc07
@ -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 = [];
|
||||
|
3
ui/jquery.ui.widget.js
vendored
3
ui/jquery.ui.widget.js
vendored
@ -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,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user