Skip to content

Commit 7498d39

Browse files
committed
Fix EventedControl inheritance
Ref: Leaflet/Leaflet#9841
1 parent cf6ee51 commit 7498d39

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/control.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,12 @@ class EventedControl {
105105
* @internal
106106
*/
107107
interface EventedControl extends L.Control, L.Evented {}
108-
Object.assign(EventedControl.prototype, L.Control.prototype);
109-
Object.assign(EventedControl.prototype, L.Evented.prototype);
108+
Object.getOwnPropertyNames(L.Control.prototype).forEach(
109+
k => (EventedControl.prototype[k] = L.Control.prototype[k])
110+
);
111+
Object.getOwnPropertyNames(L.Evented.prototype).forEach(
112+
k => (EventedControl.prototype[k] = L.Evented.prototype[k])
113+
);
110114

111115
/**
112116
* This is the geocoder control. It works like any other [Leaflet control](https://leafletjs.com/reference.html#control), and is added to the map.

0 commit comments

Comments
 (0)