OpenLayers OpenLayers

Ticket #1034: pagePosition.patch

File pagePosition.patch, 1.4 kB (added by crschmidt, 1 year ago)
  • tests/test_Util.html

    old new  
    1919        OpenLayers.Util.removeItem(array, 3); 
    2020        t.eq( array.toString(), "1,2,4,5", "Util.removeItem works");     
    2121    } 
     22     
     23    function test_03_Util_pagePosition(t) { 
     24        t.plan( 1 ); 
     25        var pp = OpenLayers.Util.pagePosition(window); 
     26        t.eq( pp.toString(), "0,0", "Page position doesn't bail if passed 'window'") 
     27         
     28    } 
    2229 
    2330    function test_04_Util_createDiv(t) { 
    2431        t.plan( 24 ); 
  • lib/OpenLayers/Util.js

    old new  
    991991    while(element) { 
    992992 
    993993        if(element == document.body) { 
    994             if(OpenLayers.Element.getStyle(child, 'position') == 'absolute') { 
     994            // FIXME: IE, when passed 'window' as the forElement, treats it as 
     995            // equal to document.body, but window.style fails, so getStyle 
     996            // fails, so we are paranoid and check this here. This check should 
     997            // probably move into element.getStyle in 2.6. 
     998            if(child && child.style &&  
     999               OpenLayers.Element.getStyle(child, 'position') == 'absolute') { 
    9951000                break; 
    9961001            } 
    9971002        }