]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Have _createButtons access the buttons option directly. Start refactoring...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 15 Nov 2012 21:54:49 +0000 (22:54 +0100)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 26 Nov 2012 09:28:22 +0000 (10:28 +0100)
ui/jquery.ui.dialog.js

index cb4230eac959c3b78dfef7d7748aa7a510e8941e..58989847666b40cf3d3384e48bbd4faf876e07ed 100644 (file)
@@ -191,7 +191,7 @@ $.widget("ui.dialog", {
                }
 
                // TODO merge with _createButtonPane?
-               this._createButtons( options.buttons );
+               this._createButtons();
 
                this._isOpen = false;
 
@@ -362,8 +362,9 @@ $.widget("ui.dialog", {
                this._delay( checkFocus );
        },
 
-       _createButtons: function( buttons ) {
-               var that = this;
+       _createButtons: function() {
+               var that = this,
+                       buttons = this.options.buttons;
 
                // if we already have a button pane, remove it
                this.uiDialogButtonPane.remove();
@@ -573,10 +574,11 @@ $.widget("ui.dialog", {
 
                this._super( key, value );
 
+               if ( key === "buttons" ) {
+                       this._createButtons();
+               }
+
                switch ( key ) {
-                       case "buttons":
-                               this._createButtons( value );
-                               break;
                        case "closeText":
                                // ensure that we always pass a string
                                this.uiDialogTitlebarClose.button({