[OpenLayers-Dev] Map id

Frédéric Junod frederic.junod at camptocamp.com
Tue Feb 26 03:02:50 EST 2008


Hello,

This is not not a good idea to control the CSS by using the id of the html
elements: they are generated by a "random" algorithm and can change. You have
guarantees that the id will always be "OpenLayers.Map_2.

Your graphics designer should use the CSS class instead.

Regards,

fredj


Le Tue, 26 Feb 2008 08:30:23 +0100,
Nils Weinander <nils.weinander at curalia.se> a écrit :

> Hello developers
> 
> In OpenLayers 2.5, Map.js line 272 an OpenLayers.Map object
> gets its id by
> 
> this.id = OpenLayers.Util.createUniqueID("OpenLayers.Map_");
> 
> which looks like an excellent scheme for identification.
> However, our graphics designer has encountered a problem
> due to the ".". The Map id is used in the ids of some child
> elements as well, the PanZoom zoombar <div> for example,
> which gets an id like
> 
> OpenLayers_Control_PanZoomBar_ZoombarOpenLayers.Map_2
> 
> This element cannot be addressed in CSS. Probably the CSS
> processing interprets "." as the start of a new class name.
> 
> We have locally changed the Map id to
> 
> this.id = OpenLayers.Util.createUniqueID("OpenLayers_Map_");
> 
> My questions are:
> 
> * Is this likely to cause other problems?
> * Is the original id scheme to be considered a bug? If so,
>    how do I best report it formally?
> 


-- 
Frédéric Junod
Camptocamp SA



More information about the Dev mailing list