Dialog: Use $.isEmptyObject() to check if there a button-option properties

This commit is contained in:
Jörn Zaefferer 2012-11-09 17:42:11 +01:00
parent 4e03321fd7
commit 324d54dd32

View File

@ -365,20 +365,13 @@ $.widget("ui.dialog", {
}, },
_createButtons: function( buttons ) { _createButtons: function( buttons ) {
var that = this, var that = this;
hasButtons = false;
// if we already have a button pane, remove it // if we already have a button pane, remove it
this.uiDialogButtonPane.remove(); this.uiDialogButtonPane.remove();
this.uiButtonSet.empty(); this.uiButtonSet.empty();
// TODO use jQuery.isEmptyObject() if ( !$.isEmptyObject( buttons ) ) {
if ( typeof buttons === "object" && buttons !== null ) {
$.each( buttons, function() {
return !(hasButtons = true);
});
}
if ( hasButtons ) {
$.each( buttons, function( name, props ) { $.each( buttons, function( name, props ) {
var button, click; var button, click;
props = $.isFunction( props ) ? props = $.isFunction( props ) ?