Changeset 12117

Show
Ignore:
Timestamp:
01/21/08 17:14:50 (12 months ago)
Author:
bill
Message:

Modify API doc of dojo._abs() to match behavior on FF.
Modify behavior of dojo_abs() on Safari3 and Opera9 to match behavior on FF.
This fixes popup positioning on safari (fixes #5295).
html.js unit test still passes.
Tested on FF2, FF3, Safari, IE6.
!strict

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/_base/html.js

    r12116 r12117  
    845845        dojo._abs = function(/*DomNode*/node, /*Boolean?*/includeScroll){ 
    846846                //      summary: 
    847                 //              Gets the absolute position of the passed element based on the 
    848                 //              document itself. Returns an object of the form: 
     847                //              Gets the position of the passed element relative to 
     848                //              the viewport (if includeScroll==false), or relative to the 
     849                //              document root (if includeScroll==true). 
     850                // 
     851                //              Returns an object of the form: 
    849852                //                      { x: 100, y: 300 } 
    850853                //              if includeScroll is passed, the x and y values will include any 
     
    859862                        y: 0 
    860863                }; 
    861                 var hasScroll = false; 
    862864 
    863865                // targetBoxType == "border-box" 
     
    876878                }else{ 
    877879                        if(node["offsetParent"]){ 
    878                                 hasScroll = true; 
    879880                                var endNode; 
    880881                                // in Safari, if the node is an absolutely positioned child of 
     
    893894                                if(node.parentNode != db){ 
    894895                                        var nd = node; 
    895                                         if(dojo.isOpera || (dojo.isSafari >= 3)){ nd = db; } 
     896                                        if(dojo.isOpera){ nd = db; } 
    896897                                        ret.x -= _sumAncestorProperties(nd, "scrollLeft"); 
    897898                                        ret.y -= _sumAncestorProperties(nd, "scrollTop"); 
     
    918919                // if offsetParent is used, ret value already includes scroll position 
    919920                // so we may have to actually remove that value if !includeScroll 
    920                 if(hasScroll || includeScroll){ 
     921                if(includeScroll){ 
    921922                        var scroll = dojo._docScroll(); 
    922                         var m = hasScroll ? (!includeScroll ? -1 : 0) : 1; 
    923                         ret.y += m*scroll.y; 
    924                         ret.x += m*scroll.x; 
     923                        ret.y += scroll.y; 
     924                        ret.x += scroll.x; 
    925925                } 
    926926