Skip to content

Commit

Permalink
Dialog: Have _createButtons access the buttons option directly. Start…
Browse files Browse the repository at this point in the history
… refactoring _setOption, no need for switch.
  • Loading branch information
jzaefferer committed Nov 26, 2012
1 parent fed2972 commit 7e964be
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ui/jquery.ui.dialog.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ $.widget("ui.dialog", {
} }


// TODO merge with _createButtonPane? // TODO merge with _createButtonPane?
this._createButtons( options.buttons ); this._createButtons();


this._isOpen = false; this._isOpen = false;


Expand Down Expand Up @@ -362,8 +362,9 @@ $.widget("ui.dialog", {
this._delay( checkFocus ); this._delay( checkFocus );
}, },


_createButtons: function( buttons ) { _createButtons: function() {
var that = this; var that = this,
buttons = this.options.buttons;


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


this._super( key, value ); this._super( key, value );


if ( key === "buttons" ) {
this._createButtons();
}

switch ( key ) { switch ( key ) {
case "buttons":
this._createButtons( value );
break;
case "closeText": case "closeText":
// ensure that we always pass a string // ensure that we always pass a string
this.uiDialogTitlebarClose.button({ this.uiDialogTitlebarClose.button({
Expand Down

0 comments on commit 7e964be

Please sign in to comment.