CloudMade/Leaflet — pull request #1222 by jacobtoye (2012-12-18 20:07:37+00:00)
Title: Fix callInitHooks so child initHooks aren't called for parent classes

In the situation where you have a class that inherited from another that already had initHooks the parent class would also call whatever function you added as an init hook for the child.

E.g.

````
Class A

Class B extends A

A.addInitHook(function F1() {});

B.addInitHook(function F2() {});
````

Here `A.callInitHooks()` would call both `F1()` and `F2()` since the `initHooks` was the same.

What you really want is for `callInitHooks` to traverse it parents and once reach the top, start calling each objects `initHooks`.

This was quite a confusing one! @danzel and I worked it out on the whiteboard ;)