Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absence of "new" works in more cases. #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions classy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
* :copyright: (c) 2011 by Armin Ronacher.
* :license: BSD.
*/
!function (context) {
'use strict';
!function (definition) {
if (typeof module != 'undefined' && module.exports) module.exports = definition()
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition)
else this.Class = definition()
}(function (undefined) {
else context.Class = definition()
}(function (undefined) {
var
CLASSY_VERSION = '1.4',
context = this,
old = context.Class,
disable_constructor = false;

Expand Down Expand Up @@ -122,7 +123,7 @@
var rv = function() {
if (disable_constructor)
return;
var proper_this = context === this ? cheapNew(arguments.callee) : this;
var proper_this = this instanceof rv ? this : cheapNew(rv);
if (proper_this.__init__)
proper_this.__init__.apply(proper_this, arguments);
proper_this.$class = rv;
Expand Down Expand Up @@ -158,4 +159,5 @@

/* export the class */
return Class;
});
});
}(this);