Widget: Added ability to generate an item if no item is passed on creation.

This commit is contained in:
Scott González 2011-01-22 20:30:40 -05:00
parent f165c93127
commit 3a0b617bb4

View File

@ -116,10 +116,12 @@ $.Widget = function( options, element ) {
$.Widget.prototype = { $.Widget.prototype = {
widgetName: "widget", widgetName: "widget",
widgetEventPrefix: "", widgetEventPrefix: "",
defaultElement: "<div>",
options: { options: {
disabled: false disabled: false
}, },
_createWidget: function( options, element ) { _createWidget: function( options, element ) {
element = $( element || this.defaultElement )[ 0 ];
// $.widget.bridge stores the plugin instance, but we do it anyway // $.widget.bridge stores the plugin instance, but we do it anyway
// so that it's stored even before the _create function runs // so that it's stored even before the _create function runs
$.data( element, this.widgetName, this ); $.data( element, this.widgetName, this );