[OpenLayers-Commits] r5132 - sandbox/ahocevar/sldRenderer/lib/OpenLayers
commits at openlayers.org
commits at openlayers.org
Tue Nov 6 16:09:23 EST 2007
Author: ahocevar
Date: 2007-11-06 16:09:22 -0500 (Tue, 06 Nov 2007)
New Revision: 5132
Modified:
sandbox/ahocevar/sldRenderer/lib/OpenLayers/Style.js
Log:
applied patch from Pierre. Thanks!
Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Style.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Style.js 2007-11-06 20:37:26 UTC (rev 5131)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Style.js 2007-11-06 21:09:22 UTC (rev 5132)
@@ -194,8 +194,14 @@
OpenLayers.Style.createLiteral = function(value, feature) {
if (typeof value == "string" && value.indexOf("${") != -1) {
var attributes = feature.attributes || feature.data;
- for (var i in attributes) {
- value = value.replace("${"+i+"}", attributes[i]);
+ //TBD: try which one is faster
+ //for (var i in attributes) {
+ // value = value.replace("${"+i+"}", attributes[i]);
+ //}
+ var re = /\$\{(\w+)\}/g;
+ var a;
+ while (a = re.exec(value)) {
+ value = value.replace(a[0], attributes[a[1]]);
}
}
return value;
More information about the Commits
mailing list