Hi,

I think there is a javascript bug with the naming of the map object when using OpenLayers. At the moment the object is named as
MappingKit.MapClient.OpenLayers.maps.map-0
but from what I can tell variable names in javascript should not contain hyphens.

It obviously works in use but it's causing a problem debugging, as if you enter the above object name into the firebug console you get Nan rather than an object, as it interprets the line as
MappingKit.MapClient.OpenLayers.maps.map - 0
ie the hyphen is interpreted as a minus symbol.

I thought it might be a bug in Firebug, but if you add
alert(MappingKit.MapClient.OpenLayers.maps.map-0);
to the javascript it returns Nan instead of Object.

So, a simple patch to change the naming of the map object.

Index: /Users/mark/WorkingCopies/EA/sites/all/modules/mappingkit/mapclient/common.mapclient.inc
===================================================================
--- common.mapclient.inc	(revision 1)
+++ common.mapclient.inc	(working copy)
@@ -20,7 +20,7 @@
   $logger->debug('map attrs ', $attrs);
   
   if (!isset($attrs['id'])) {
-    $attrs['id'] = 'map-'. $map_count;
+    $attrs['id'] = 'map_'. $map_count;
   }
   
   // add mapclient class
CommentFileSizeAuthor
map_name.patch451 bytesmuhleder

Comments

jpulles’s picture

Status: Needs review » Closed (won't fix)

The object can always be used as MappingKit.MapClient.OpenLayers.maps['map-0'].