[OpenLayers-Commits] r11730 - in trunk/openlayers: lib/OpenLayers
tests
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Mar 28 09:53:04 EDT 2011
Author: ahocevar
Date: 2011-03-28 06:52:59 -0700 (Mon, 28 Mar 2011)
New Revision: 11730
Modified:
trunk/openlayers/lib/OpenLayers/Events.js
trunk/openlayers/tests/Map.html
Log:
making clearMouseCache work when document.body is not ready, which fixes a regression. r=bartvde (closes #3189)
Modified: trunk/openlayers/lib/OpenLayers/Events.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Events.js 2011-03-27 17:00:38 UTC (rev 11729)
+++ trunk/openlayers/lib/OpenLayers/Events.js 2011-03-28 13:52:59 UTC (rev 11730)
@@ -860,10 +860,9 @@
// returns incorrect offsets. So our best bet is to not invalidate the
// offsets once we have them, and hope that the page was not scrolled
// when we did the initial calculation.
- if (!((document.body.scrollTop != 0 ||
- document.body.scrollLeft != 0) &&
- navigator.userAgent.match(/iPhone/i))) {
- OpenLayers.Console.log("clear");
+ var body = document.body;
+ if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
+ navigator.userAgent.match(/iPhone/i))) {
this.element.offsets = null;
}
},
Modified: trunk/openlayers/tests/Map.html
===================================================================
--- trunk/openlayers/tests/Map.html 2011-03-27 17:00:38 UTC (rev 11729)
+++ trunk/openlayers/tests/Map.html 2011-03-28 13:52:59 UTC (rev 11730)
@@ -1593,9 +1593,21 @@
}
+ // test if we can call updateSize before document.body is ready. updateOk
+ // is tested in the test_updateSize function below
+ var earlyMap = new OpenLayers.Map();
+ var updateOk;
+ try {
+ earlyMap.updateSize();
+ updateOk = true;
+ } catch(e) {}
+ earlyMap.destroy();
function test_updateSize(t) {
- t.plan(2);
+ t.plan(3);
+ // checking updateSize from outside this test function (see above)
+ t.ok(updateOk, "updateSize works before document.body is ready");
+
var map, moveToCnt, size;
map = new OpenLayers.Map({div: "map"});
@@ -1625,7 +1637,7 @@
map.updateSize();
t.eq(moveToCnt, 1, "updateSize move the map if it has a center");
- map.destroy();
+ map.destroy();
}
function test_invisible_map(t) {
More information about the Commits
mailing list