openlayers/ol-mapbox-style

Maybe a bug in stylefunction

toddwong opened this issue · 2 comments

https://github.com/openlayers/ol-mapbox-style/blob/bd5fe28b82071ad1da8e5996f5bd491c2aa1156b/src/stylefunction.js#L423C45-L423C45

    if (
      (typeof sourceOrLayers == 'string' && layer.source == sourceOrLayers) ||
      sourceOrLayers.indexOf(layerId) !== -1
    ) 

If sourceOrLayers is a string and layer.source != sourceOrLayers, then the indexOf function would be String.prototype.indexOf instead of Array.prototype.indexOf.

Good find, @toddwong. Thanks! Would you be able to create a pull request with a test and a fix?

@ahocevar Sorry for taking so long to reply. I've been too busy recently. I'll make the PR a little bit later.