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) {
|
||||
if (ev.layer.getAttribution) {
|
||||
this.addAttribution(ev.layer.getAttribution());
|
||||
ev.layer.once('remove', function () {
|
||||
this.removeAttribution(ev.layer.getAttribution());
|
||||
}, this);
|
||||
ev.layer.once('remove', () => this.removeAttribution(ev.layer.getAttribution()));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -165,9 +165,7 @@ function removeOne(obj, type, fn, context, id) {
|
||||
// @function stopPropagation(ev: DOMEvent): this
|
||||
// Stop the given event from propagation to parent elements. Used inside the listener functions:
|
||||
// ```js
|
||||
// L.DomEvent.on(div, 'click', function (ev) {
|
||||
// L.DomEvent.stopPropagation(ev);
|
||||
// });
|
||||
// L.DomEvent.on(div, 'click', L.DomEvent.stopPropagation);
|
||||
// ```
|
||||
export function stopPropagation(e) {
|
||||
|
||||
|
@ -107,9 +107,7 @@ export const Layer = Evented.extend({
|
||||
if (this.getEvents) {
|
||||
const events = this.getEvents();
|
||||
map.on(events, this);
|
||||
this.once('remove', function () {
|
||||
map.off(events, this);
|
||||
}, this);
|
||||
this.once('remove', () => map.off(events, this));
|
||||
}
|
||||
|
||||
this.onAdd(map);
|
||||
|
@ -220,10 +220,10 @@ export const Popup = DivOverlay.extend({
|
||||
closeButton.href = '#close';
|
||||
closeButton.innerHTML = '<span aria-hidden="true">×</span>';
|
||||
|
||||
DomEvent.on(closeButton, 'click', function (ev) {
|
||||
DomEvent.on(closeButton, 'click', (ev) => {
|
||||
DomEvent.preventDefault(ev);
|
||||
this.close();
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user