Skip to content

Commit 4ccccf7

Browse files
committed
Replace DomEvent.addListener with DomEvent.on
Ref: Leaflet/Leaflet#9834
1 parent 7498d39 commit 4ccccf7

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/control.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ export class GeocoderControl extends EventedControl {
199199
);
200200
L.DomEvent.disableClickPropagation(this._alts);
201201

202-
L.DomEvent.addListener(input, 'keydown', this._keydown, this);
202+
L.DomEvent.on(input, 'keydown', this._keydown, this);
203203
if (this.options.geocoder?.suggest) {
204-
L.DomEvent.addListener(input, 'input', this._change, this);
204+
L.DomEvent.on(input, 'input', this._change, this);
205205
}
206-
L.DomEvent.addListener(input, 'blur', () => {
206+
L.DomEvent.on(input, 'blur', () => {
207207
if (this.options.collapsed && !this._preventBlurCollapse) {
208208
this._collapse();
209209
}
@@ -212,13 +212,13 @@ export class GeocoderControl extends EventedControl {
212212

213213
if (this.options.collapsed) {
214214
if (this.options.expand === 'click') {
215-
L.DomEvent.addListener(container, 'click', (e: Event) => {
215+
L.DomEvent.on(container, 'click', (e: Event) => {
216216
if ((e as MouseEvent).button === 0 && (e as MouseEvent).detail !== 2) {
217217
this._toggle();
218218
}
219219
});
220220
} else if (this.options.expand === 'touch') {
221-
L.DomEvent.addListener(
221+
L.DomEvent.on(
222222
container,
223223
L.Browser.touch ? 'touchstart mousedown' : 'mousedown',
224224
(e: Event) => {
@@ -229,16 +229,16 @@ export class GeocoderControl extends EventedControl {
229229
this
230230
);
231231
} else {
232-
L.DomEvent.addListener(container, 'mouseover', this._expand, this);
233-
L.DomEvent.addListener(container, 'mouseout', this._collapse, this);
232+
L.DomEvent.on(container, 'mouseover', this._expand, this);
233+
L.DomEvent.on(container, 'mouseout', this._collapse, this);
234234
this._map.on('movestart', this._collapse, this);
235235
}
236236
} else {
237237
this._expand();
238238
if (L.Browser.touch) {
239-
L.DomEvent.addListener(container, 'touchstart', () => this._geocode());
239+
L.DomEvent.on(container, 'touchstart', () => this._geocode());
240240
} else {
241-
L.DomEvent.addListener(container, 'click', () => this._geocode());
241+
L.DomEvent.on(container, 'click', () => this._geocode());
242242
}
243243
}
244244

@@ -403,7 +403,7 @@ export class GeocoderControl extends EventedControl {
403403
// Use mousedown and not click, since click will fire _after_ blur,
404404
// causing the control to have collapsed and removed the items
405405
// before the click can fire.
406-
L.DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this);
406+
L.DomEvent.on(li, 'mousedown touchstart', mouseDownHandler, this);
407407

408408
return li;
409409
}

0 commit comments

Comments
 (0)