Only valid characters in generated ids.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
* @requires OpenLayers/Control.js
|
||||
* @requires OpenLayers/Lang.js
|
||||
* @requires OpenLayers/Console.js
|
||||
* @requires OpenLayers/Util.js
|
||||
* @requires OpenLayers/Events/buttonclick.js
|
||||
*/
|
||||
|
||||
@@ -52,7 +53,6 @@ OpenLayers.Control.LayerSwitcher =
|
||||
*/
|
||||
layerStates: null,
|
||||
|
||||
|
||||
// DOM Elements
|
||||
|
||||
/**
|
||||
@@ -325,8 +325,14 @@ OpenLayers.Control.LayerSwitcher =
|
||||
: layer.getVisibility();
|
||||
|
||||
// create input element
|
||||
var inputElem = document.createElement("input");
|
||||
inputElem.id = this.id + "_input_" + layer.name;
|
||||
var inputElem = document.createElement("input"),
|
||||
// The input shall have an id attribute so we can use
|
||||
// labels to interact with them.
|
||||
inputId = OpenLayers.Util.createUniqueID(
|
||||
this.id + "_input_"
|
||||
);
|
||||
|
||||
inputElem.id = inputId;
|
||||
inputElem.name = (baseLayer) ? this.id + "_baseLayers" : layer.name;
|
||||
inputElem.type = (baseLayer) ? "radio" : "checkbox";
|
||||
inputElem.value = layer.name;
|
||||
@@ -342,6 +348,8 @@ OpenLayers.Control.LayerSwitcher =
|
||||
|
||||
// create span
|
||||
var labelSpan = document.createElement("label");
|
||||
// this isn't the DOM attribute 'for', but an arbitrary name we
|
||||
// use to find the appropriate input element in <onButtonClick>
|
||||
labelSpan["for"] = inputElem.id;
|
||||
OpenLayers.Element.addClass(labelSpan, "labelSpan olButton");
|
||||
labelSpan._layer = layer.id;
|
||||
|
||||
Reference in New Issue
Block a user