exception in animation handler for:onAnimate
TypeError: Unable to get property 'width' of undefined or null reference
Hi
I have a site, it is accessed at times with URLs with parameters (default zoom, default layers, and stuff)
In IE if I go straight via a shortcut/hyperlink elsewhere I get
exception in animation handler for:onAnimate
TypeError: Unable to get property 'width' of undefined or null reference
In the IE debug window and something then goes splut and nothing loads.
I use the browser refresh and all is fine. If I go to the URL bar in IE and hit enter it fails again
Tome, this looks like my init function isn't completing at the right time and various components haven't been loaded, but why this odd behaviour that it only fails when going there directly, and not on refresh? It even works if I clear the cache before hitting refresh, so it isn't the fact that it loads the scripts locall;y, therefore faster.
Puzzled!
ACm
Adrian,
Can you reproduce this with one of the samples? Or do you have a simple test case that shows the problem?
Not really, the code I have is quite complex. I've just tested it on a public example of my site and it was fine. Very strange.
A bit more digging (I'm not too good with the IE debug tools) the function that is throwing the first error is
_onZoomHandler: function(b, e, c) {
b = this._startRect;
var d = b.width * e,
f = b.height * e,
g = this._img,
h = a("ie");
g && (h && 8 > h ? k.set(g, {
left: b.left - (d - b.width) * (c.x - b.left) / b.width + "px",
top: b.top - (f - b.height) * (c.y - b.top) / b.height + "px",
zoom: e * b.zoom
}) : k.set(g, {
left: b.left - (d - b.width) * (c.x - b.left) / b.width + "px",
top: b.top - (f - b.height) * (c.y - b.top) / b.height + "px",
width: d + "px",
height: f + "px"
}))
},
the actual line is 03 above.
What is your app doing when it loads the url params. Are you modifying the default extent using something like map.setExtent? If so try waiting for the response before continuing to modify the map. For example:
map.setExtent(extent).then(function(){
//do something here
});
I'll give that a shot, but from testing yesterday it seemed that;
I've modenized my cade with the init code wrapped in a
require(["dojo/ready"], function (ready) {
ready(1000, function () {
Rather than doing it the old way - this didn't work, but at least I have a bit mre control.
Cheers
ACM
branched to IE fails to use proxy on first load - site stops