Skip to content

Commit e6e9258

Browse files
committed
Dialog: Have _createButtons access the buttons option directly. Start refactoring _setOption, no need for switch.
1 parent e960918 commit e6e9258

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ui/jquery.ui.dialog.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ $.widget("ui.dialog", {
191191
}
192192

193193
// TODO merge with _createButtonPane?
194-
this._createButtons( options.buttons );
194+
this._createButtons();
195195

196196
this._isOpen = false;
197197

@@ -362,8 +362,9 @@ $.widget("ui.dialog", {
362362
this._delay( checkFocus );
363363
},
364364

365-
_createButtons: function( buttons ) {
366-
var that = this;
365+
_createButtons: function() {
366+
var that = this,
367+
buttons = this.options.buttons;
367368

368369
// if we already have a button pane, remove it
369370
this.uiDialogButtonPane.remove();
@@ -573,10 +574,11 @@ $.widget("ui.dialog", {
573574

574575
this._super( key, value );
575576

577+
if ( key === "buttons" ) {
578+
this._createButtons();
579+
}
580+
576581
switch ( key ) {
577-
case "buttons":
578-
this._createButtons( value );
579-
break;
580582
case "closeText":
581583
// ensure that we always pass a string
582584
this.uiDialogTitlebarClose.button({

0 commit comments

Comments
 (0)