aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2009-01-17 21:31:43 +0000
committerScott González <scott.gonzalez@gmail.com>2009-01-17 21:31:43 +0000
commitc2903d5c42f3723cdf98a5310707a9f10bc96dbd (patch)
tree1b4962b82269b2f96e4b99007d0d5cab8c70fcac /ui
parent60856ea46146ad93e173fe1cddff9f882c73d916 (diff)
downloadjquery-ui-c2903d5c42f3723cdf98a5310707a9f10bc96dbd.tar.gz
jquery-ui-c2903d5c42f3723cdf98a5310707a9f10bc96dbd.zip
Dialog: Fixed #3688: Don't add the button pane div if there are no buttons.
Diffstat (limited to 'ui')
-rw-r--r--ui/ui.dialog.js26
1 files changed, 12 insertions, 14 deletions
diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js
index bd5d3b850..0489844f2 100644
--- a/ui/ui.dialog.js
+++ b/ui/ui.dialog.js
@@ -126,15 +126,7 @@ $.widget("ui.dialog", {
.addClass('ui-dialog-title')
.attr('id', titleId)
.html(title)
- .prependTo(uiDialogTitlebar),
-
- uiDialogButtonPane = (this.uiDialogButtonPane = $('<div></div>'))
- .addClass(
- 'ui-dialog-buttonpane ' +
- 'ui-widget-content ' +
- 'ui-helper-clearfix'
- )
- .appendTo(uiDialog);
+ .prependTo(uiDialogTitlebar);
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
@@ -256,14 +248,19 @@ $.widget("ui.dialog", {
_createButtons: function(buttons) {
var self = this,
hasButtons = false,
- uiDialogButtonPane = this.uiDialogButtonPane;
+ uiDialogButtonPane = $('<div></div>')
+ .addClass(
+ 'ui-dialog-buttonpane ' +
+ 'ui-widget-content ' +
+ 'ui-helper-clearfix'
+ );
- // remove any existing buttons
- uiDialogButtonPane.empty().hide();
+ // if we already have a button pane, remove it
+ this.uiDialog.find('.ui-dialog-buttonpane').remove();
- $.each(buttons, function() { return !(hasButtons = true); });
+ (typeof buttons == 'object' && buttons !== null &&
+ $.each(buttons, function() { return !(hasButtons = true); }));
if (hasButtons) {
- uiDialogButtonPane.show();
$.each(buttons, function(name, fn) {
$('<button type="button"></button>')
.addClass(
@@ -288,6 +285,7 @@ $.widget("ui.dialog", {
})
.appendTo(uiDialogButtonPane);
});
+ uiDialogButtonPane.appendTo(this.uiDialog);
}
},