Bug Tracker

Changeset 5355

Show
Ignore:
Timestamp:
04/29/08 23:19:03 (7 months ago)
Author:
scott.gonzalez
Message:

UI Base: Removed dimensions/offset methods (now in core).

Files:
1 modified

Legend:

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

    r5174 r5355  
    6161        }, 
    6262        hasScroll: function(e, a) { 
    63             var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false; 
    64             if (e[scroll] > 0) return true; e[scroll] = 1; 
    65             has = e[scroll] > 0 ? true : false; e[scroll] = 0; 
    66             return has;  
    67         } 
     63            var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false; 
     64            if (e[scroll] > 0) return true; e[scroll] = 1; 
     65            has = e[scroll] > 0 ? true : false; e[scroll] = 0; 
     66            return has; 
     67        } 
    6868    }); 
    6969 
    7070    /******* fn scope modifications ********/ 
    7171 
    72     $.each( ['Left', 'Top'], function(i, name) { 
    73         if(!$.fn['scroll'+name]) $.fn['scroll'+name] = function(v) { 
    74             return v != undefined ? 
    75                 this.each(function() { this == window || this == document ? window.scrollTo(name == 'Left' ? v : $(window)['scrollLeft'](), name == 'Top'  ? v : $(window)['scrollTop']()) : this['scroll'+name] = v; }) : 
    76                 this[0] == window || this[0] == document ? self[(name == 'Left' ? 'pageXOffset' : 'pageYOffset')] || $.boxModel && document.documentElement['scroll'+name] || document.body['scroll'+name] : this[0][ 'scroll' + name ]; 
    77         }; 
    78     }); 
    79  
    8072    var _remove = $.fn.remove; 
    8173    $.fn.extend({ 
    82         position: function() { 
    83             var offset       = this.offset(); 
    84             var offsetParent = this.offsetParent(); 
    85             var parentOffset = offsetParent.offset(); 
    86  
    87             return { 
    88                 top:  offset.top - num(this[0], 'marginTop')  - parentOffset.top - num(offsetParent, 'borderTopWidth'), 
    89                 left: offset.left - num(this[0], 'marginLeft')  - parentOffset.left - num(offsetParent, 'borderLeftWidth') 
    90             }; 
    91         }, 
    92         offsetParent: function() { 
    93             var offsetParent = this[0].offsetParent; 
    94             while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') ) 
    95                 offsetParent = offsetParent.offsetParent; 
    96             return $(offsetParent); 
    97         }, 
    9874        mouseInteraction: function(o) { 
    9975            return this.each(function() { 
     
    11288        } 
    11389    }); 
    114      
    115     function num(el, prop) { 
    116         return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0; 
    117     }; 
    11890     
    11991     
     
    148120                || (this.options.condition && !this.options.condition.apply(this.options.executor || this, [e, this.element])) //Prevent execution on condition 
    149121            ) return true; 
    150                  
     122             
    151123            var self = this; 
    152124            var initialize = function() { 
     
    155127                $(document).bind('mousemove.draggable', function() { return self.drag.apply(self, arguments); }); 
    156128                 
    157                 if(!self.initalized && Math.abs(self._MP.left-e.pageX) >= self.options.distance || Math.abs(self._MP.top-e.pageY) >= self.options.distance) {                
     129                if(!self.initalized && Math.abs(self._MP.left-e.pageX) >= self.options.distance || Math.abs(self._MP.top-e.pageY) >= self.options.distance) { 
    158130                    if(self.options.start) self.options.start.call(self.options.executor || self, e, self.element); 
    159131                    if(self.options.drag) self.options.drag.call(self.options.executor || self, e, this.element); //This is actually not correct, but expected 
     
    172144             
    173145        }, 
    174         stop: function(e) {          
     146        stop: function(e) { 
    175147             
    176148            var o = this.options; 
     
    188160            if ($.browser.msie && !e.button) return this.stop.apply(this, [e]); // IE mouseup check 
    189161             
    190             if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) {               
     162            if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) { 
    191163                if(this.options.start) this.options.start.call(this.options.executor || this, e, this.element); 
    192164                this.initialized = true;