Toward dotless identifiers.
This commit is contained in:
@@ -139,7 +139,8 @@ OpenLayers.Util.indexOf = function(array, obj) {
|
||||
*
|
||||
* Parameters:
|
||||
* element - {DOMElement} DOM element to modify.
|
||||
* id - {String} The element id attribute to set.
|
||||
* id - {String} The element id attribute to set. Note that dots (".") will be
|
||||
* replaced with underscore ("_") in setting the element id.
|
||||
* px - {<OpenLayers.Pixel>|Object} The element left and top position,
|
||||
* OpenLayers.Pixel or an object with
|
||||
* a 'x' and 'y' properties.
|
||||
@@ -157,7 +158,7 @@ OpenLayers.Util.modifyDOMElement = function(element, id, px, sz, position,
|
||||
border, overflow, opacity) {
|
||||
|
||||
if (id) {
|
||||
element.id = id;
|
||||
element.id = id.replace(/\./g, "_");
|
||||
}
|
||||
if (px) {
|
||||
element.style.left = px.x + "px";
|
||||
@@ -195,7 +196,8 @@ OpenLayers.Util.modifyDOMElement = function(element, id, px, sz, position,
|
||||
* Parameters:
|
||||
* id - {String} An identifier for this element. If no id is
|
||||
* passed an identifier will be created
|
||||
* automatically.
|
||||
* automatically. Note that dots (".") will be replaced with
|
||||
* underscore ("_") when generating ids.
|
||||
* px - {<OpenLayers.Pixel>|Object} The element left and top position,
|
||||
* OpenLayers.Pixel or an object with
|
||||
* a 'x' and 'y' properties.
|
||||
@@ -928,6 +930,7 @@ OpenLayers.Util.lastSeqID = 0;
|
||||
*
|
||||
* Parameters:
|
||||
* prefix - {String} Optional string to prefix unique id. Default is "id_".
|
||||
* Note that dots (".") in the prefix will be replaced with underscore ("_").
|
||||
*
|
||||
* Returns:
|
||||
* {String} A unique id string, built on the passed in prefix.
|
||||
@@ -935,6 +938,8 @@ OpenLayers.Util.lastSeqID = 0;
|
||||
OpenLayers.Util.createUniqueID = function(prefix) {
|
||||
if (prefix == null) {
|
||||
prefix = "id_";
|
||||
} else {
|
||||
prefix = prefix.replace(/\./g, "_");
|
||||
}
|
||||
OpenLayers.Util.lastSeqID += 1;
|
||||
return prefix + OpenLayers.Util.lastSeqID;
|
||||
|
||||
Reference in New Issue
Block a user