OpenLayers OpenLayers

Changeset 4783

Show
Ignore:
Timestamp:
10/03/07 12:15:43 (11 months ago)
Author:
crschmidt
Message:

IE thinks that window and document.body are really the same thing -- even
though one has a style property and the other doesn't. This means that when
we pass in 'window' to pagePosition, it blows up, but it didin't before a
recent reorganization. Here, we create a short term preventative measure to
ensure that old apps don't break -- this should be fixed in 2.6.
(See #1034, #1051)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Util.js

    r4302 r4783  
    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            } 
  • trunk/openlayers/tests/test_Util.html

    r4302 r4783  
    1919        OpenLayers.Util.removeItem(array, 3); 
    2020        t.eq( array.toString(), "1,2,4,5", "Util.removeItem works");     
     21    } 
     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         
    2128    } 
    2229