Bug Tracker

Changeset 5608

Show
Ignore:
Timestamp:
05/15/08 14:41:12 (7 months ago)
Author:
scott.gonzalez
Message:

UI Dialog: Cleaned up JavaScript warnings.

Files:
1 modified

Legend:

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

    r5595 r5608  
    4444                .wrap(document.createElement('div')); 
    4545            var uiDialogContainer = uiDialogContent.parent().addClass('ui-dialog-container').css({position: 'relative'}); 
    46             var uiDialog = this.uiDialog = uiDialogContainer.parent().hide() 
     46            var uiDialog = (this.uiDialog = uiDialogContainer.parent()).hide() 
    4747                .addClass('ui-dialog') 
    4848                .css({position: 'absolute', width: options.width, height: options.height, overflow: 'hidden'});  
     
    5252            // Add content classes to dialog, to inherit theme at top level of element 
    5353            $.each(classNames, function(i, className) { 
    54                 if (className != 'ui-dialog-content') 
    55                     uiDialog.addClass(className); 
     54                ((className != 'ui-dialog-content') 
     55                    && uiDialog.addClass(className)); 
    5656            }); 
    5757     
     
    7373                    resize: options.resize, 
    7474                    stop: function(e, ui) { 
    75                         options.resizeStop && options.resizeStop.apply(this, arguments); 
     75                        (options.resizeStop && options.resizeStop.apply(this, arguments)); 
    7676                        $.ui.dialog.overlay.resize(); 
    7777                    } 
    7878                }); 
    79                 if (!options.resizable) 
    80                     uiDialog.resizable('disable'); 
     79                (!options.resizable && uiDialog.resizable('disable')); 
    8180            } 
    8281     
     
    104103                if (options.closeOnEscape) { 
    105104                    var ESC = 27; 
    106                     ev.keyCode && ev.keyCode == ESC && self.close(); 
     105                    (ev.keyCode && ev.keyCode == ESC && self.close()); 
    107106                } 
    108107            }); 
     
    116115                    $(document.createElement('button')) 
    117116                        .text(name) 
    118                         .click(function() { fn.apply(self.element, arguments) }) 
     117                        .click(function() { fn.apply(self.element, arguments); }) 
    119118                        .appendTo(uiDialogButtonPane); 
    120119                }); 
     
    126125                    start: function(e, ui) { 
    127126                        self.activate(); 
    128                         options.dragStart && options.dragStart.apply(this, arguments); 
     127                        (options.dragStart && options.dragStart.apply(this, arguments)); 
    129128                    }, 
    130129                    drag: options.drag, 
    131130                    stop: function(e, ui) { 
    132                         options.dragStop && options.dragStop.apply(this, arguments); 
     131                        (options.dragStop && options.dragStop.apply(this, arguments)); 
    133132                        $.ui.dialog.overlay.resize(); 
    134133                    } 
    135134                }); 
    136                 if (!options.draggable) 
    137                     uiDialog.draggable('disable') 
     135                (!options.draggable && uiDialog.draggable('disable')); 
    138136            } 
    139137         
     
    145143            }); 
    146144             
    147             options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe(); 
    148              
    149             if (options.autoOpen) { 
    150                 this.open(); 
    151             }; 
     145            (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe()); 
     146             
     147            (options.autoOpen && this.open()); 
    152148        }, 
    153149         
    154150        setData: function(key, value){ 
    155             setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value); 
     151            (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); 
    156152            switch (key) { 
    157153                case "draggable": 
     
    189185            } 
    190186            if (pos.constructor != Array) { 
    191                 pos == ['center', 'middle'] 
     187                pos = ['center', 'middle']; 
    192188            } 
    193189            if (pos[0].constructor == Number) { 
     
    201197                        pLeft += (wnd.width()) - (this.uiDialog.width()); 
    202198                        break; 
     199                    default: 
    203200                    case 'center': 
    204                     default: 
    205201                        pLeft += (wnd.width() / 2) - (this.uiDialog.width() / 2); 
    206202                } 
     
    216212                        pTop += (wnd.height()) - (this.uiDialog.height()); 
    217213                        break; 
     214                    default: 
    218215                    case 'middle': 
    219                     default: 
    220216                        pTop += (wnd.height() / 2) - (this.uiDialog.height() / 2); 
    221217                } 
     
    252248            // would make any modeless dialogs that it spawned unusable until 
    253249            // the modal dialog is closed. 
    254             !this.options.modal && this.moveToTop(); 
     250            (!this.options.modal && this.moveToTop()); 
    255251        }, 
    256252             
     
    260256                maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex); 
    261257            }); 
    262             this.overlay && this.overlay.$el.css('z-index', ++maxZ); 
     258            (this.overlay && this.overlay.$el.css('z-index', ++maxZ)); 
    263259            this.uiDialog.css('z-index', ++maxZ); 
    264260        }, 
    265261             
    266262        close: function() { 
    267             this.overlay && this.overlay.destroy(); 
     263            (this.overlay && this.overlay.destroy()); 
    268264            this.uiDialog.hide(); 
    269265 
     
    278274         
    279275        destroy: function() { 
    280             this.overlay && this.overlay.destroy(); 
     276            (this.overlay && this.overlay.destroy()); 
    281277            this.uiDialog.hide(); 
    282278            this.element 
     
    347343                $(document).bind('keydown.dialog-overlay', function(e) { 
    348344                    var ESC = 27; 
    349                     e.keyCode && e.keyCode == ESC && dialog.close();  
     345                    (e.keyCode && e.keyCode == ESC && dialog.close());  
    350346                }); 
    351347                 
     
    362358                }, dialog.options.overlay)); 
    363359             
    364             dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe(); 
     360            (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe()); 
    365361             
    366362            this.instances.push($el);