2 ms·
> Huh, weird. This seems to crib very heavily from my original Simple JavaScript Inheritance implementation: http://ejohn.org/blog/simple-javascript-inheritance
by the_mitsuhiko 17y ago
> Huh, weird. This seems to crib very heavily from my original Simple JavaScript Inheritance implementation: http://ejohn.org/blog/simple-javascript-inheritance/ http://ejohn.org/blog/simple-javascript-inheritance/
It is, see the AUTHORS file which credits that URL. In fact I was using a slightly modified version of your code for a long time but had to do some changes in order to use it for a project of mine.
Basically I need classes implemented in a way that they will work in the presence of any other JavaScript framework. Reason: this JavaScript is injected into unknown code by a middleware system.
> It even uses the 'classy' name and logo (stemming from an April Fools joke that I ran that used the aforementioned inheritance implementation): http://ejohn.org/blog/classy-query/ http://ejohn.org/blog/classy-query/
Interesting. I did not know that one. Name was rather obvious and did not return any direct hits with projects named like this so I went with it. The original drawing of that logo is the search result on Google images for "classy" with filter set to linedrawing. Original author unknown, I just vectorized it.
> ... but on the whole it looks very very similar to the original implementation that I wrote. Odd.
If you want a more obvious attribution than the AUTHORS file, just let me know.
Other changes besides hasOwnProperty, the ability to use the library without modifying window, and $ prefixed names so that it does not clash with custom attributes is a more python/javascript inspired naming scheme for special methods and attributes (__init__ etc.) and support for mixins. Also attributes are properly removed if they were unset previously and not just reassigned with undefined and classes can be instanciated without new like in Python. Can't count how often my code did funny stuff because I forgot new there :)
All in all, the idea is to have that fairly common piece of object orientated JavaScript class bootstrapping under an open source license so that anyone can use it. I hope I succeeded with that.