Fixed styleNames creation for layers with mixed strings and arrays.

Thanks dwins for spotting this and the quick patch, which, btw, was 
perfect (i.e. with unit tests that show the problem). r=me (closes #2025)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@9161 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2009-04-01 15:39:58 +00:00
parent b1c11b9814
commit bfc17248e9
2 changed files with 64 additions and 6 deletions

View File

@@ -79,6 +79,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
* }
* (end)
*/
vendorParams: {},
/**
* Property: formats
@@ -284,8 +285,15 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
// specifying styles,we need the same number of commas to specify
// the default style for each of the layers. We can't just leave it
// blank as we may be including other layers that do specify styles.
styleNames = styleNames.concat(layers[i].params.STYLES ||
layers[i].params.LAYERS.replace(/[^,]/g,""));
if (layers[i].params.STYLES) {
styleNames = styleNames.concat(layers[i].params.STYLES);
} else {
if (layers[i].params.LAYERS instanceof Array) {
styleNames = styleNames.concat(new Array(layers[i].params.LAYERS.length));
} else { // Assume it's a String
styleNames = styleNames.concat(layers[i].params.LAYERS.replace(/[^,]/g, ""));
}
}
}
var wmsOptions = {