Ticket #2607 (new feature)
Opened 3 years ago
Wrong CSS class name for activated Controls with multiple class names
|Reported by:||cdauth||Owned by:|
OpenLayers.Control objects have a property called displayClass that contains the CSS class name used for the div element. By default, a class name is generated from the object’s CLASS_NAME property, but the value can be overridden.
The activate() method of the Control class adds an additional CSS class to the ViewPort element, the displayClass of the Control with the suffix “Active”. This additional class is removed by the deactivate() method again.
You can assign multiple CSS classes to a HTML element by using a space as delimiter. The activate() and deactivate() methods do not handle such a displayClass correctly. Instead of appending the suffix to each CSS class on its own, the spaces are removed before creating the “Active” class. Setting displayClass to “class1 class2” creates “class1class2Active”. It should rather create “class1Active class2Active”.
A similar issue exists in OpenLayers.Control.Panel, which creates class names with the suffixes “ItemActive” and “ItemInactive” to highlight which of the controls in the panel has been selected.