CloudMade/Leaflet — pull request #683 by cfis (2012-05-12 23:34:03+00:00)
Title: _tileLayersToLoad Cleanup

When a tileLayer is added or removed from a map, the _tileLayersNum property is appropriately updated but the _tileLayersToLoad is not. It is not updated until resetView, but that is called after the method _onTileLayerLoad is called. Thus, if you add one tile layer the _tileLayersToLoad is zero and when _onTileLayerLoad is called the values is decremented to -1.

This in the end doesn't make a difference on the initial zoom level of a map because _onTileLayerLoad also checks to see if there is a background tile layer, which there is not until after a first zoom. However, this seems to me a bug waiting to happen, thus the patch.