Bug Tracker

Changeset 5275

Show
Ignore:
Timestamp:
04/21/08 22:54:46 (9 months ago)
Author:
brandon.aaron
Message:

Small optimization to offset (thanks Ariel Flesler)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/offset.js

    r4997 r5275  
    1111            doc          = elem.ownerDocument, 
    1212            safari2      = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent), 
    13             fixed        = jQuery.css(elem, "position") == "fixed"; 
     13            css          = jQuery.curCSS, 
     14            fixed        = css(elem, "position") == "fixed"; 
    1415     
    1516        // Use getBoundingClientRect if available 
     
    4647                     
    4748                // Add the document scroll offsets if position is fixed on any offsetParent 
    48                 if ( !fixed && jQuery.css(offsetParent, "position") == "fixed" ) 
     49                if ( !fixed && css(offsetParent, "position") == "fixed" ) 
    4950                    fixed = true; 
    5051             
     
    5859            while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) { 
    5960                // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug 
    60                 if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) ) 
     61                if ( !/^inline|table.*$/i.test(css(parent, "display")) ) 
    6162                    // Subtract parent scroll offsets 
    6263                    add( -parent.scrollLeft, -parent.scrollTop ); 
    6364             
    6465                // Mozilla does not add the border for a parent that has overflow != visible 
    65                 if ( mozilla && jQuery.css(parent, "overflow") != "visible" ) 
     66                if ( mozilla && css(parent, "overflow") != "visible" ) 
    6667                    border( parent ); 
    6768             
     
    7273            // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild 
    7374            // Mozilla doubles body offsets with a non-absolutely positioned offsetChild 
    74             if ( (safari2 && (fixed || jQuery.css(offsetChild, "position") == "absolute")) ||  
    75                 (mozilla && jQuery.css(offsetChild, "position") != "absolute") ) 
     75            if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||  
     76                (mozilla && css(offsetChild, "position") != "absolute") ) 
    7677                    add( -doc.body.offsetLeft, -doc.body.offsetTop ); 
    7778