diff --git a/debug/vector/geojson.html b/debug/vector/geojson.html
index fa426137..d5d4a104 100644
--- a/debug/vector/geojson.html
+++ b/debug/vector/geojson.html
@@ -60,21 +60,21 @@
// control that shows state info on hover
- var info = L.Util.extend(L.control(), {
+ var info = L.control();
- onAdd: function (map) {
- this._div = L.DomUtil.create('div', 'info');
- this.update();
- return this._div;
- },
+ info.onAdd = function (map) {
+ this._div = L.DomUtil.create('div', 'info');
+ this.update();
+ return this._div;
+ };
- update: function (props) {
- this._div.innerHTML = '
US Population Density
' + (props ?
- '' + props.name + '
' + props.density + ' people / mi2'
- : 'Hover over a state');
- }
+ info.update = function (props) {
+ this._div.innerHTML = 'US Population Density
' + (props ?
+ '' + props.name + '
' + props.density + ' people / mi2'
+ : 'Hover over a state');
+ };
- }).addTo(map);
+ info.addTo(map);
// get color depending on population density value
@@ -137,25 +137,32 @@
onEachFeature: onEachFeature
}).addTo(map);
+ map.attributionControl.addAttribution('Population data © US Census Bureau');
- // legend control
- L.Util.extend(L.control({position: 'bottomright'}), {
- onAdd: function (map) {
- var div = L.DomUtil.create('div', 'info legend'),
- grades = [0, 10, 20, 50, 100, 200, 500, 1000],
- labels = [];
+ var legend = L.control({position: 'bottomright'});
- for (var i = 0; i < grades.length; i++) {
- labels.push(' ' +
- grades[i] + (grades[i + 1] ? '–' + grades[i + 1] : '+'));
- }
+ legend.onAdd = function (map) {
- div.innerHTML = labels.join('
');
- return div;
+ var div = L.DomUtil.create('div', 'info legend'),
+ grades = [0, 10, 20, 50, 100, 200, 500, 1000],
+ labels = [],
+ from, to;
+
+ for (var i = 0; i < grades.length; i++) {
+ from = grades[i];
+ to = grades[i + 1];
+
+ labels.push(
+ ' ' +
+ from + (to ? '–' + to : '+'));
}
- }).addTo(map);
+ div.innerHTML = labels.join('
');
+ return div;
+ };
+
+ legend.addTo(map);