diff --git a/debug/map/image-overlay.html b/debug/map/image-overlay.html
index 21377b6b..14b49134 100644
--- a/debug/map/image-overlay.html
+++ b/debug/map/image-overlay.html
@@ -35,7 +35,8 @@
var overlay = new L.ImageOverlay("https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg", bounds, {
opacity: 0.5,
- interactive: true
+ interactive: true,
+ attribution: '© A.B.B Corp.'
});
map.addLayer(overlay);
diff --git a/debug/vector/geojson.html b/debug/vector/geojson.html
index 8b274f6c..7b0f89ac 100644
--- a/debug/vector/geojson.html
+++ b/debug/vector/geojson.html
@@ -136,10 +136,10 @@
geojson = L.geoJson(statesData, {
style: style,
- onEachFeature: onEachFeature
+ onEachFeature: onEachFeature,
+ attribution: 'Population data © US Census Bureau'
});
- geojson.getAttribution = function() { return 'Population data © US Census Bureau' };
geojson.addTo(map);
diff --git a/src/layer/ImageOverlay.js b/src/layer/ImageOverlay.js
index 07626bde..db6425b2 100644
--- a/src/layer/ImageOverlay.js
+++ b/src/layer/ImageOverlay.js
@@ -31,10 +31,6 @@ L.ImageOverlay = L.Layer.extend({
// If `true`, the image overlay will emit [mouse events](#interactive-layer) when clicked or hovered.
interactive: false,
- // @option attribution: String = null
- // An optional string containing HTML to be shown on the `Attribution control`
- attribution: null,
-
// @option crossOrigin: Boolean = false
// If true, the image will have its crossOrigin attribute set to ''. This is needed if you want to access image pixel data.
crossOrigin: false
@@ -128,10 +124,6 @@ L.ImageOverlay = L.Layer.extend({
return this;
},
- getAttribution: function () {
- return this.options.attribution;
- },
-
getEvents: function () {
var events = {
zoom: this._reset,
diff --git a/src/layer/Layer.js b/src/layer/Layer.js
index 4636bbcc..f1c6428a 100644
--- a/src/layer/Layer.js
+++ b/src/layer/Layer.js
@@ -31,7 +31,11 @@ L.Layer = L.Evented.extend({
// @option pane: String = 'overlayPane'
// By default the layer will be added to the map's [overlay pane](#map-overlaypane). Overriding this option will cause the layer to be placed on another pane by default.
pane: 'overlayPane',
- nonBubblingEvents: [] // Array of events that should not be bubbled to DOM parents (like the map)
+ nonBubblingEvents: [], // Array of events that should not be bubbled to DOM parents (like the map),
+
+ // @option attribution: String = null
+ // String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
+ attribution: null,
},
/* @section
@@ -76,6 +80,12 @@ L.Layer = L.Evented.extend({
return this;
},
+ // @method getAttribution: String
+ // Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution).
+ getAttribution: function () {
+ return this.options.attribution;
+ },
+
_layerAdd: function (e) {
var map = e.target;
diff --git a/src/layer/tile/GridLayer.js b/src/layer/tile/GridLayer.js
index e32aca24..35867303 100644
--- a/src/layer/tile/GridLayer.js
+++ b/src/layer/tile/GridLayer.js
@@ -89,10 +89,6 @@ L.GridLayer = L.Layer.extend({
// Tiles will not update more than once every `updateInterval` milliseconds when panning.
updateInterval: 200,
- // @option attribution: String = null
- // String to be shown in the attribution control, describes the layer data, e.g. "© Mapbox".
- attribution: null,
-
// @option zIndex: Number = 1
// The explicit zIndex of the tile layer.
zIndex: 1,
@@ -174,12 +170,6 @@ L.GridLayer = L.Layer.extend({
return this;
},
- // @method getAttribution: String
- // Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution).
- getAttribution: function () {
- return this.options.attribution;
- },
-
// @method getContainer: HTMLElement
// Returns the HTML element that contains the tiles for this layer.
getContainer: function () {