"Object #<HTMLDivElement> has no method xxxxxx" error in Chrome

Discussion created by bb1769 on Jul 13, 2011
I got this error when activating a custom tool in Chrome. Firefox and IE worked fine. Just thought I'd pass along the cause in case it helps others. In my case I had created a component (ASP.NET user control) that plugs into the web application, and it included some JavaScript. The JavaScript needed to access the Map object on startup, but it couldn't assume the map would be created already. So I added code like this:

function init() {
if (map) {
   // do startup stuff
  setTimeout('init()', 100);

(yes, I know there are better ways to link up the component to the map, but this works for now...)

In Chrome, my custom tool was throwing a mysterious error:
Object #<HTMLDivElement> has no method '__resetClickDuration'
It wasn't until I ran into the same issue with a different component with the error of:
Object #<HTMLDivElement> has no method 'setExtent'
Which made me realize it was the map that wasn't working right. I changed the above code so that the map must be loaded first:

if (map && map.loaded) {

This change held off until "map" was actually loaded as the ESRI Map rather than just pointing to the HTML map <div>.