[OpenLayers-Trac] [OpenLayers] #3657: Handler/Box.js - Causing map to shift when calculating boxOfffsets in IE8

OpenLayers trac-20090302 at openlayers.org
Wed May 16 09:50:33 EDT 2012


#3657: Handler/Box.js - Causing map to shift when calculating boxOfffsets in IE8
---------------------+------------------------------------------------------
 Reporter:  ca0v     |       Owner:     
     Type:  bug      |      Status:  new
 Priority:  minor    |   Milestone:     
Component:  general  |     Version:  SVN
 Keywords:           |       State:     
---------------------+------------------------------------------------------
 By adding these lines to the getBoxOffsets method the map will no longer
 shift in IE8.  I could not determine why the map was shifting without this
 change...maybe scrollbars were being temporarily created...but certainly
 with this seemingly harmless change the issue was resolved.  Set
 testDiv.style.top = testDivstyle.left = -9999 before adding the div to the
 document.


     getBoxOffsets: function() {
         if (!this.boxOffsets) {
             // Determine the box model. If the testDiv's clientWidth is 3,
 then
             // the borders are outside and we are dealing with the w3c box
             // model. Otherwise, the browser uses the traditional box
 model and
             // the borders are inside the box bounds, leaving us with a
             // clientWidth of 1.
             var testDiv = document.createElement("div");
             //testDiv.style.visibility = "hidden";
 here ->     testDiv.style.top = -9999;
 here ->     testDiv.style.left = -9999;
             testDiv.style.position = "absolute";
             testDiv.style.border = "1px solid black";

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3657>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list