Switch to sequential ID numbering. Fixes #226.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2645 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -622,6 +622,8 @@ OpenLayers.Util.getArgs = function(url) {
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OpenLayers.Util.lastSeqID = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} prefix String to prefix random id. If null, default
|
* @param {String} prefix String to prefix random id. If null, default
|
||||||
* is "id_"
|
* is "id_"
|
||||||
@@ -633,7 +635,8 @@ OpenLayers.Util.createUniqueID = function(prefix) {
|
|||||||
if (prefix == null) {
|
if (prefix == null) {
|
||||||
prefix = "id_";
|
prefix = "id_";
|
||||||
}
|
}
|
||||||
return prefix + Math.round(Math.random() * 10000);
|
OpenLayers.Util.lastSeqID += 1;
|
||||||
|
return prefix + OpenLayers.Util.lastSeqID;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Constant inches per unit
|
/** Constant inches per unit
|
||||||
|
|||||||
@@ -563,7 +563,13 @@
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function test_Util_createUniqueIDSeq(t) {
|
||||||
|
t.plan(1);
|
||||||
|
OpenLayers.Util.lastSeqID = 0;
|
||||||
|
OpenLayers.Util.createDiv();
|
||||||
|
OpenLayers.Util.createDiv();
|
||||||
|
t.eq(OpenLayers.Util.createDiv().id, "OpenLayersDiv3", "Div created is sequential, starting at lastSeqID in Util.");
|
||||||
|
}
|
||||||
// -->
|
// -->
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user