Bug Tracker

Changeset 5596

Show
Ignore:
Timestamp:
05/14/08 17:23:44 (7 months ago)
Author:
aflesler
Message:

jquery dimensions: reducing the code size.

Files:
1 modified

Legend:

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

    r5577 r5596  
    22jQuery.each([ "Height", "Width" ], function(i, name){ 
    33 
    4     var tl = name == "Height" ? "Top"    : "Left",  // top or left 
    5         br = name == "Height" ? "Bottom" : "Right"; // bottom or right 
     4    var tl = i ? "Left"  : "Top",  // top or left 
     5        br = i ? "Right" : "Bottom"; // bottom or right 
    66 
    77    // innerHeight and innerWidth 
     
    1717            num(this, "border" + tl + "Width") + 
    1818            num(this, "border" + br + "Width") + 
    19             (!!margin ? 
     19            (margin ? 
    2020                num(this, "margin" + tl) + num(this, "margin" + br) : 0); 
    2121    }; 
     
    2424 
    2525function num(elem, prop) { 
    26     elem = elem.jquery ? elem[0] : elem; 
    27     return elem && parseInt( jQuery.curCSS(elem, prop, true), 10 ) || 0; 
     26    return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; 
    2827}