Skip to content

Commit e19d462

Browse files
committed
All: Delegate to base _getCreateOptions().
Ensures that any extensions to the base widget will be handled properly by individual widgets. Closes jquerygh-1598
1 parent afbcdbe commit e19d462

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

tests/unit/widget/core.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,17 @@ test( "merge multiple option arguments", function() {
267267
} );
268268

269269
test( "._getCreateOptions()", function() {
270-
expect( 3 );
270+
expect( 4 );
271271
$.widget( "ui.testWidget", {
272272
options: {
273273
option1: "valuex",
274274
option2: "valuex",
275275
option3: "value3"
276276
},
277277
_getCreateOptions: function() {
278+
var superOptions = this._super();
279+
280+
deepEqual( superOptions, {}, "Base implementation returns empty object" );
278281

279282
// Support: IE8
280283
// Strict equality fails when comparing this.window in ie8

ui/widget.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@ $.Widget.prototype = {
322322
this._init();
323323
},
324324

325-
_getCreateOptions: $.noop,
325+
_getCreateOptions: function() {
326+
return {};
327+
},
326328

327329
_getCreateEventData: $.noop,
328330

ui/widgets/selectmenu.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,11 @@ return $.widget( "ui.selectmenu", {
646646
},
647647

648648
_getCreateOptions: function() {
649-
return { disabled: this.element.prop( "disabled" ) };
649+
var options = this._super();
650+
651+
options.disabled = this.element.prop( "disabled" );
652+
653+
return options;
650654
},
651655

652656
_parseOptions: function( options ) {

ui/widgets/spinner.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ $.widget( "ui.spinner", {
104104
},
105105

106106
_getCreateOptions: function() {
107-
var options = {},
108-
element = this.element;
107+
var options = this._super();
108+
var element = this.element;
109109

110110
$.each( [ "min", "max", "step" ], function( i, option ) {
111111
var value = element.attr( option );

0 commit comments

Comments
 (0)