making clearMouseCache work when document.body is not ready, which fixes a regression. r=bartvde (closes #3189)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11730 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -860,10 +860,9 @@ OpenLayers.Events = OpenLayers.Class({
|
|||||||
// returns incorrect offsets. So our best bet is to not invalidate the
|
// 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
|
// offsets once we have them, and hope that the page was not scrolled
|
||||||
// when we did the initial calculation.
|
// when we did the initial calculation.
|
||||||
if (!((document.body.scrollTop != 0 ||
|
var body = document.body;
|
||||||
document.body.scrollLeft != 0) &&
|
if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
|
||||||
navigator.userAgent.match(/iPhone/i))) {
|
navigator.userAgent.match(/iPhone/i))) {
|
||||||
OpenLayers.Console.log("clear");
|
|
||||||
this.element.offsets = null;
|
this.element.offsets = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+13
-1
@@ -1593,8 +1593,20 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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) {
|
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;
|
var map, moveToCnt, size;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user