Further optimizations: remove hasOwnProperty backward compat

This commit is contained in:
Anatoliy Chakkaev 2012-10-16 01:29:30 +04:00
parent da9ff3e1e8
commit dbb39bf43e
2 changed files with 6 additions and 6 deletions

View File

@ -519,7 +519,7 @@ AbstractClass.prototype.toObject = function (onlySchema) {
this.constructor.forEachProperty(function (attr) {
if (self[attr] instanceof List) {
data[attr] = self[attr].toObject();
} else if (self.hasOwnProperty(attr)) {
} else if (self.__data.hasOwnProperty(attr)) {
data[attr] = self[attr];
} else {
data[attr] = null;
@ -537,10 +537,10 @@ AbstractClass.prototype.toObject = function (onlySchema) {
return data;
};
AbstractClass.prototype.hasOwnProperty = function (prop) {
return this.__data && this.__data.hasOwnProperty(prop) ||
Object.getOwnPropertyNames(this).indexOf(prop) !== -1;
};
// AbstractClass.prototype.hasOwnProperty = function (prop) {
// return this.__data && this.__data.hasOwnProperty(prop) ||
// Object.getOwnPropertyNames(this).indexOf(prop) !== -1;
// };
AbstractClass.prototype.toJSON = function () {
return this.toObject();

View File

@ -428,7 +428,7 @@ function skipValidation(inst, conf, kind) {
if (typeof inst[conf[kind]] === 'function') {
doValidate = inst[conf[kind]].call(inst);
if (kind === 'unless') doValidate = !doValidate;
} else if (inst.hasOwnProperty(conf[kind])) {
} else if (inst.__data.hasOwnProperty(conf[kind])) {
doValidate = inst[conf[kind]];
if (kind === 'unless') doValidate = !doValidate;
} else {