mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-16 16:45:22 +00:00
Use arrow callback (#9684)
This commit is contained in:
@ -62,9 +62,7 @@ export const Attribution = Control.extend({
|
|||||||
_addAttribution(ev) {
|
_addAttribution(ev) {
|
||||||
if (ev.layer.getAttribution) {
|
if (ev.layer.getAttribution) {
|
||||||
this.addAttribution(ev.layer.getAttribution());
|
this.addAttribution(ev.layer.getAttribution());
|
||||||
ev.layer.once('remove', function () {
|
ev.layer.once('remove', () => this.removeAttribution(ev.layer.getAttribution()));
|
||||||
this.removeAttribution(ev.layer.getAttribution());
|
|
||||||
}, this);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -165,9 +165,7 @@ function removeOne(obj, type, fn, context, id) {
|
|||||||
// @function stopPropagation(ev: DOMEvent): this
|
// @function stopPropagation(ev: DOMEvent): this
|
||||||
// Stop the given event from propagation to parent elements. Used inside the listener functions:
|
// Stop the given event from propagation to parent elements. Used inside the listener functions:
|
||||||
// ```js
|
// ```js
|
||||||
// L.DomEvent.on(div, 'click', function (ev) {
|
// L.DomEvent.on(div, 'click', L.DomEvent.stopPropagation);
|
||||||
// L.DomEvent.stopPropagation(ev);
|
|
||||||
// });
|
|
||||||
// ```
|
// ```
|
||||||
export function stopPropagation(e) {
|
export function stopPropagation(e) {
|
||||||
|
|
||||||
|
@ -107,9 +107,7 @@ export const Layer = Evented.extend({
|
|||||||
if (this.getEvents) {
|
if (this.getEvents) {
|
||||||
const events = this.getEvents();
|
const events = this.getEvents();
|
||||||
map.on(events, this);
|
map.on(events, this);
|
||||||
this.once('remove', function () {
|
this.once('remove', () => map.off(events, this));
|
||||||
map.off(events, this);
|
|
||||||
}, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onAdd(map);
|
this.onAdd(map);
|
||||||
|
@ -220,10 +220,10 @@ export const Popup = DivOverlay.extend({
|
|||||||
closeButton.href = '#close';
|
closeButton.href = '#close';
|
||||||
closeButton.innerHTML = '<span aria-hidden="true">×</span>';
|
closeButton.innerHTML = '<span aria-hidden="true">×</span>';
|
||||||
|
|
||||||
DomEvent.on(closeButton, 'click', function (ev) {
|
DomEvent.on(closeButton, 'click', (ev) => {
|
||||||
DomEvent.preventDefault(ev);
|
DomEvent.preventDefault(ev);
|
||||||
this.close();
|
this.close();
|
||||||
}, this);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user