In #772 the events mixin was changed for leaflet 1.2+ to use L.Evented.prototype instead of L.Mixin.Events. But it was also moved from the prototype declaration to the init function. So an added init hook (L.Draw.Feature.addInitHook(function() {});) is done before the initialize function and added to the _initHooks props. In the initialize function it includes the L.Evented.prototype or L.Mixin.Events mixin which includes a property _initHooks (empty array) and so override the current added init hooks.
What behaviour I'm expecting and which behaviour I'm seeing
The init hook should be called, but isn't.
Minimal example reproducing the issue
[x] this example is as simple as possible
[x] this example does not rely on any third party code
How to reproduce
Found out about this because I'm using leaflet-snap which add an initHook here: https://github.com/makinacorpus/Leaflet.Snap/blob/5597677fe16744219c480afe7c7e7fce78cc71fd/leaflet.snap.js#L659
In #772 the events mixin was changed for leaflet 1.2+ to use
L.Evented.prototype
instead ofL.Mixin.Events
. But it was also moved from the prototype declaration to the init function. So an added init hook (L.Draw.Feature.addInitHook(function() {});
) is done before the initialize function and added to the_initHooks
props. In the initialize function it includes theL.Evented.prototype
orL.Mixin.Events
mixin which includes a property_initHooks
(empty array) and so override the current added init hooks.What behaviour I'm expecting and which behaviour I'm seeing
The init hook should be called, but isn't.
Minimal example reproducing the issue
With leaflet-draw 0.4.12 the init hook is called: https://jsfiddle.net/mvp7hgou/44/ With leaflet-draw 0.4.13 the init hook is not called: https://jsfiddle.net/mvp7hgou/45/
I guess
L.Toolbar
has the same problem.