Skip to content

Commit 3a0b617

Browse files
committed
Widget: Added ability to generate an item if no item is passed on creation.
1 parent f165c93 commit 3a0b617

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ui/jquery.ui.widget.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@ $.Widget = function( options, element ) {
116116
$.Widget.prototype = {
117117
widgetName: "widget",
118118
widgetEventPrefix: "",
119+
defaultElement: "<div>",
119120
options: {
120121
disabled: false
121122
},
122123
_createWidget: function( options, element ) {
124+
element = $( element || this.defaultElement )[ 0 ];
123125
// $.widget.bridge stores the plugin instance, but we do it anyway
124126
// so that it's stored even before the _create function runs
125127
$.data( element, this.widgetName, this );

0 commit comments

Comments
 (0)