Fixed non-removable attributions regression #488

This commit is contained in:
mourner 2012-02-15 10:54:17 +02:00
parent 538dfb4cff
commit ba5b40cc19
5 changed files with 18 additions and 14 deletions

View File

@ -15,6 +15,10 @@ Leaflet Changelog
* Fixed a bug where `TileLayer.WMS` wouldn't take `insertAtTheBottom` option into account (by [@bmcbride](https://github.com/bmcbride)). [#478](https://github.com/CloudMade/Leaflet/pull/478)
## 0.3.2 RC
* Fixed a regression where removeLayer would not remove corresponding attribution. [#488](https://github.com/CloudMade/Leaflet/issues/488)
## 0.3.1 (14.02.2012)
* Fixed a regression where default marker icons wouldn't work if Leaflet include url contained a query string.

View File

@ -5,9 +5,9 @@
<link rel="stylesheet" href="../../dist/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->
<link rel="stylesheet" href="../css/screen.css" />
<script src="../leaflet-include.js"></script>
</head>
<body>
@ -15,23 +15,23 @@
<div id="map"></div>
<script type="text/javascript">
function getCloudMadeUrl(styleId) {
return 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/' + styleId + '/256/{z}/{x}/{y}.png';
}
var cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
cloudmade = new L.TileLayer(getCloudMadeUrl(997), {attribution: cloudmadeAttribution}),
cloudmade2 = new L.TileLayer(getCloudMadeUrl(998), {attribution: cloudmadeAttribution});
cloudmade2 = new L.TileLayer(getCloudMadeUrl(998), {attribution: 'Hello world'});
var map = new L.Map('map').addLayer(cloudmade).setView(new L.LatLng(50.5, 30.51), 15);
var marker = new L.Marker(new L.LatLng(50.5, 30.505));
map.addLayer(marker);
var marker2 = new L.Marker(new L.LatLng(50.502, 30.515));
map.addLayer(marker2);
var layersControl = new L.Control.Layers({
'CloudMade Fresh': cloudmade,
'CloudMade Pale Dawn': cloudmade2
@ -39,9 +39,9 @@
'Some marker': marker,
'Another marker': marker2
});
map.addControl(layersControl);
</script>
</body>
</html>
</html>

2
dist/leaflet-src.js vendored
View File

@ -4912,7 +4912,7 @@ L.Control.Attribution = L.Class.extend({
var attribs = [];
for (var i in this._attributions) {
if (this._attributions.hasOwnProperty(i)) {
if (this._attributions.hasOwnProperty(i) && this._attributions[i]) {
attribs.push(i);
}
}

2
dist/leaflet.js vendored

File diff suppressed because one or more lines are too long

View File

@ -51,7 +51,7 @@ L.Control.Attribution = L.Class.extend({
var attribs = [];
for (var i in this._attributions) {
if (this._attributions.hasOwnProperty(i)) {
if (this._attributions.hasOwnProperty(i) && this._attributions[i]) {
attribs.push(i);
}
}