Skip to content

Commit

Permalink
Dialog: Extract button pane creation into _createButtonPane
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaefferer committed Nov 26, 2012
1 parent 1d6ce64 commit 4c9caa8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
10 changes: 9 additions & 1 deletion tests/visual/dialog/complex-dialogs.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@
var dialog = $( "#dialog" ).dialog({
modal: true,
height: 300,
width: 500
width: 500,
buttons: [
{
text: "Ok"
},
{
text: "Cancel"
}
]
}),

datepickerDialog = $( "#dialog-datepicker" ).dialog({
Expand Down
26 changes: 13 additions & 13 deletions ui/jquery.ui.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,8 @@ $.widget("ui.dialog", {
.addClass( "ui-dialog-content ui-widget-content" )
.appendTo( this.uiDialog );

this._createTitlebar();

// TODO extract this one and the next into a _createButtonPane method
uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
.addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );

( this.uiButtonSet = $( "<div>" ) )
.addClass( "ui-dialog-buttonset" )
.appendTo( uiDialogButtonPane );

this._createTitlebar();
this._createButtonPane();

// TODO move into _createWrapper
// We assume that any existing aria-describedby attribute means
Expand All @@ -151,9 +143,6 @@ $.widget("ui.dialog", {
this._makeResizable();
}

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

this._isOpen = false;

// prevent tabbing out of dialogs
Expand Down Expand Up @@ -365,6 +354,17 @@ $.widget("ui.dialog", {
});
},

_createButtonPane: function() {
var uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
.addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );

this.uiButtonSet = $( "<div>" )
.addClass( "ui-dialog-buttonset" )
.appendTo( uiDialogButtonPane );

this._createButtons();
},

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

0 comments on commit 4c9caa8

Please sign in to comment.