Bug Tracker

Changeset 4604

Show
Ignore:
Timestamp:
02/03/08 17:30:59 (1 year ago)
Author:
jeresig
Message:

Tweaked the UI Dialog constructor.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/ui.dialog.js

    r4590 r4604  
    77        dialog: function(options, data) { 
    88            return this.each(function() { 
    9                 if (!!options && options.constructor == String) { 
    10                     var method = options; 
    11                     var dialog = $.data(this, "ui-dialog"); 
    12                     if (!dialog) { 
    13                         dialog = $.data($(this).parents(".ui-dialog:first").find(".ui-dialog-content")[0], "ui-dialog"); 
    14                     } 
    15                     dialog[method].apply(dialog, data); 
    16                 } else { 
    17                     if (!$(this).is(".ui-dialog-content")) { 
    18                         // INIT with optional options 
    19                         new $.ui.dialog(this, options); 
    20                     } 
    21                 } 
     9                if (typeof options == "string") { 
     10                    var dialog = $.data(this, "ui-dialog") || 
     11                        $.data($(this).parents(".ui-dialog:first").find(".ui-dialog-content")[0], "ui-dialog"); 
     12                    dialog[options].apply(dialog, Array.prototype.slice.apply(arguments, 1)); 
     13 
     14                // INIT with optional options 
     15                } else if (!$(this).is(".ui-dialog-content")) 
     16                    new $.ui.dialog(this, options); 
    2217            }); 
    2318        }