All: Delegate to base _getCreateOptions().

Ensures that any extensions to the base widget will be handled properly by
individual widgets.

Closes gh-1598
This commit is contained in:
Scott González 2015-09-16 12:54:12 -04:00
parent afbcdbe47e
commit e19d462f16
4 changed files with 14 additions and 5 deletions

View File

@ -267,7 +267,7 @@ test( "merge multiple option arguments", function() {
} ); } );
test( "._getCreateOptions()", function() { test( "._getCreateOptions()", function() {
expect( 3 ); expect( 4 );
$.widget( "ui.testWidget", { $.widget( "ui.testWidget", {
options: { options: {
option1: "valuex", option1: "valuex",
@ -275,6 +275,9 @@ test( "._getCreateOptions()", function() {
option3: "value3" option3: "value3"
}, },
_getCreateOptions: function() { _getCreateOptions: function() {
var superOptions = this._super();
deepEqual( superOptions, {}, "Base implementation returns empty object" );
// Support: IE8 // Support: IE8
// Strict equality fails when comparing this.window in ie8 // Strict equality fails when comparing this.window in ie8

View File

@ -322,7 +322,9 @@ $.Widget.prototype = {
this._init(); this._init();
}, },
_getCreateOptions: $.noop, _getCreateOptions: function() {
return {};
},
_getCreateEventData: $.noop, _getCreateEventData: $.noop,

View File

@ -646,7 +646,11 @@ return $.widget( "ui.selectmenu", {
}, },
_getCreateOptions: function() { _getCreateOptions: function() {
return { disabled: this.element.prop( "disabled" ) }; var options = this._super();
options.disabled = this.element.prop( "disabled" );
return options;
}, },
_parseOptions: function( options ) { _parseOptions: function( options ) {

View File

@ -104,8 +104,8 @@ $.widget( "ui.spinner", {
}, },
_getCreateOptions: function() { _getCreateOptions: function() {
var options = {}, var options = this._super();
element = this.element; var element = this.element;
$.each( [ "min", "max", "step" ], function( i, option ) { $.each( [ "min", "max", "step" ], function( i, option ) {
var value = element.attr( option ); var value = element.attr( option );