.addClass( "ui-dialog-title" )
.attr( "id", titleId )
.html( title )
- .prependTo( uiDialogTitlebar );
+ .prependTo( uiDialogTitlebar ),
+
+ uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
+ .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ),
+
+ uiButtonSet = ( this.uiButtonSet = $( "<div>" ) )
+ .addClass( "ui-dialog-buttonset" )
+ .appendTo( uiDialogButtonPane );
uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection();
this._hoverable( uiDialogTitlebarClose );
// if there are no tabbable elements, set focus on the dialog itself
hasFocus = this.element.find( ":tabbable" );
if ( !hasFocus.length ) {
- hasFocus = uiDialog.find( ".ui-dialog-buttonpane :tabbable" );
+ hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
if ( !hasFocus.length ) {
hasFocus = uiDialog;
}
hasButtons = false;
// if we already have a button pane, remove it
- this.uiDialog.find( ".ui-dialog-buttonpane" ).remove();
+ this.uiDialogButtonPane.remove();
+ this.uiButtonSet.empty();
if ( typeof buttons === "object" && buttons !== null ) {
$.each( buttons, function() {
});
}
if ( hasButtons ) {
- uiDialogButtonPane = $( "<div>" )
- .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
- uiButtonSet = $( "<div>" )
- .addClass( "ui-dialog-buttonset" )
- .appendTo( uiDialogButtonPane );
-
$.each( buttons, function( name, props ) {
props = $.isFunction( props ) ?
{ click: props, text: name } :
.click(function() {
props.click.apply( that.element[0], arguments );
})
- .appendTo( uiButtonSet );
+ .appendTo( that.uiButtonSet );
if ( $.fn.button ) {
button.button();
}
});
this.uiDialog.addClass( "ui-dialog-buttons" );
- uiDialogButtonPane.appendTo( this.uiDialog );
+ this.uiDialogButtonPane.appendTo( this.uiDialog );
} else {
this.uiDialog.removeClass( "ui-dialog-buttons" );
}