socib / Leaflet.TimeDimension

Add time dimension capabilities on a Leaflet map.
MIT License
435 stars 139 forks source link

Strict check on layer Name causes page hang #164

Closed crh3675 closed 5 years ago

crh3675 commented 5 years ago

We recently noticed when using a NOAA WMS feed, that our page would hang. The underlying cause was that NOAA had names such as <Name>0</Name> and <Name>1</Name> for their layers. It seems the code here:

    layers.forEach(function(current) {
        if (current.querySelector("Name").innerHTML === layerName) {
            layer = current;
        }
    })

becomes the issue due to strict type checking and should be updated as such:

    layers.forEach(function(current) {
        if (current.querySelector("Name").innerHTML === String(layerName)) {
            layer = current;
        }
    })