Bug Tracker

Changeset 5388

Show
Ignore:
Timestamp:
05/02/08 21:16:57 (8 months ago)
Author:
scott.gonzalez
Message:

UI Base: Fixed a bunch of warnings.

Files:
1 modified

Legend:

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

    r5373 r5388  
    6262                } 
    6363            }, 
    64             call: function(instance, name, arguments) { 
    65                 var set = instance.plugins[name]; if(!set) return; 
     64            call: function(instance, name, args) { 
     65                var set = instance.plugins[name]; 
     66                if(!set) { return; } 
     67                 
    6668                for (var i = 0; i < set.length; i++) { 
    67                     if (instance.options[set[i][0]]) set[i][1].apply(instance.element, arguments); 
     69                    if (instance.options[set[i][0]]) { 
     70                        set[i][1].apply(instance.element, args); 
     71                    } 
    6872                } 
    6973            }    
     
    7175        cssCache: {}, 
    7276        css: function(name) { 
    73             if ($.ui.cssCache[name]) return $.ui.cssCache[name]; 
     77            if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; } 
    7478            var tmp = $('<div class="ui-resizable-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body'); 
    7579             
     
    8084            //Safari returns rgba(0,0,0,0) when bgcolor is not set 
    8185            $.ui.cssCache[name] = !!( 
    82                 (!/auto|default/.test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) ||  
     86                (!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) ||  
    8387                !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))) 
    8488            ); 
     
    8892        disableSelection: function(e) { 
    8993            e.unselectable = "on"; 
    90             e.onselectstart = function() {  return false; }; 
    91             if (e.style) e.style.MozUserSelect = "none"; 
     94            e.onselectstart = function() { return false; }; 
     95            if (e.style) { e.style.MozUserSelect = "none"; } 
    9296        }, 
    9397        enableSelection: function(e) { 
    9498            e.unselectable = "off"; 
    9599            e.onselectstart = function() { return true; }; 
    96             if (e.style) e.style.MozUserSelect = ""; 
     100            if (e.style) { e.style.MozUserSelect = ""; } 
    97101        }, 
    98102        hasScroll: function(e, a) { 
     
    115119        removeMouseInteraction: function(o) { 
    116120            return this.each(function() { 
    117                 if($.data(this, "ui-mouse")) 
     121                if($.data(this, "ui-mouse")) { 
    118122                    $.data(this, "ui-mouse").destroy(); 
     123                } 
    119124            }); 
    120125        }, 
     
    137142         
    138143        $(element).bind('mousedown.draggable', function() { return self.click.apply(self, arguments); }); 
    139         if($.browser.msie) $(element).attr('unselectable', 'on'); //Prevent text selection in IE 
     144        if($.browser.msie) { 
     145            //Prevent text selection in IE 
     146            $(element).attr('unselectable', 'on'); 
     147        } 
    140148         
    141149        // prevent draggable-options-delay bug #2553 
    142150        $(element).mouseup(function() { 
    143             if(self.timer) clearInterval(self.timer); 
     151            if(self.timer) { clearInterval(self.timer); } 
    144152        }); 
    145153    }; 
     
    155163                || $.inArray(e.target.nodeName.toLowerCase(), this.options.dragPrevention || []) != -1 // Prevent execution on defined elements 
    156164                || (this.options.condition && !this.options.condition.apply(this.options.executor || this, [e, this.element])) //Prevent execution on condition 
    157             ) return true; 
     165            ) { return true; } 
    158166             
    159167            var self = this; 
     
    164172                 
    165173                if(!self.initalized && Math.abs(self._MP.left-e.pageX) >= self.options.distance || Math.abs(self._MP.top-e.pageY) >= self.options.distance) { 
    166                     if(self.options.start) self.options.start.call(self.options.executor || self, e, self.element); 
    167                     if(self.options.drag) self.options.drag.call(self.options.executor || self, e, this.element); //This is actually not correct, but expected 
     174                    if(self.options.start) { 
     175                        self.options.start.call(self.options.executor || self, e, self.element); 
     176                    } 
     177                    if(self.options.drag) { 
     178                        //This is actually not correct, but expected 
     179                        self.options.drag.call(self.options.executor || self, e, this.element); 
     180                    } 
    168181                    self.initialized = true; 
    169182                } 
     
    171184 
    172185            if(this.options.delay) { 
    173                 if(this.timer) clearInterval(this.timer); 
     186                if(this.timer) { clearInterval(this.timer); } 
    174187                this.timer = setTimeout(initialize, this.options.delay); 
    175188            } else { 
     
    183196             
    184197            var o = this.options; 
    185             if(!this.initialized) return $(document).unbind('mouseup.draggable').unbind('mousemove.draggable'); 
    186  
    187             if(this.options.stop) this.options.stop.call(this.options.executor || this, e, this.element); 
     198            if(!this.initialized) { 
     199                return $(document) 
     200                    .unbind('mouseup.draggable') 
     201                    .unbind('mousemove.draggable'); 
     202            } 
     203 
     204            if(this.options.stop) { 
     205                this.options.stop.call(this.options.executor || this, e, this.element); 
     206            } 
    188207            $(document).unbind('mouseup.draggable').unbind('mousemove.draggable'); 
    189208            this.initialized = false; 
     
    194213 
    195214            var o = this.options; 
    196             if ($.browser.msie && !e.button) return this.stop.apply(this, [e]); // IE mouseup check 
     215            if ($.browser.msie && !e.button) { 
     216                // IE mouseup check 
     217                return this.stop.apply(this, [e]); 
     218            } 
    197219             
    198220            if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) { 
    199                 if(this.options.start) this.options.start.call(this.options.executor || this, e, this.element); 
     221                if(this.options.start) { 
     222                    this.options.start.call(this.options.executor || this, e, this.element); 
     223                } 
    200224                this.initialized = true; 
    201225            } else { 
    202                 if(!this.initialized) return false; 
    203             } 
    204  
    205             if(o.drag) o.drag.call(this.options.executor || this, e, this.element); 
     226                if(!this.initialized) { return false; } 
     227            } 
     228 
     229            if(o.drag) { 
     230                o.drag.call(this.options.executor || this, e, this.element); 
     231            } 
    206232            return false; 
    207233