Skip to content

Commit

Permalink
Changing _parent to parent
Browse files Browse the repository at this point in the history
  • Loading branch information
farhadi committed Dec 17, 2009
1 parent 78ba961 commit bd67b3f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions class.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@
}

var _this = this;
var _parent = this._parent = {};
var parent = Class.parent;
var parent = this.parent = {};
var parentClass = Class.parent;

// Creating parent methods
while (true) {
for (key in parent.prototype) if (typeof parent.prototype[key] == 'function') {
_parent[key] = (function(key, parent){
for (key in parentClass.prototype) if (typeof parentClass.prototype[key] == 'function') {
parent[key] = (function(key, parentClass){
return function(){
var tmp = _this._parent;
_this._parent = _this._parent._parent;
parent.prototype[key].apply(_this, arguments);
_this._parent = tmp;
var tmp = _this.parent;
_this.parent = _this.parent.parent;
parentClass.prototype[key].apply(_this, arguments);
_this.parent = tmp;
};
})(key, parent);
})(key, parentClass);
}
if (!parent.parent) break;
parent = parent.parent;
_parent = _parent._parent = {};
if (!parentClass.parent) break;
parentClass = parentClass.parent;
parent = parent.parent = {};
}

// Enforce the constructor to be what we expect
Expand Down
2 changes: 1 addition & 1 deletion color.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
toHex: function() {
var hex = (this.r * 65536 + this.g * 256 + this.b).toString(16);
while (hex.length < 6) hex = '0' + hex;
return '#' + hex;
return '#' + hex;
}
});

Expand Down

0 comments on commit bd67b3f

Please sign in to comment.