From 9ec5ad29efe9a6119b190cdc8cb6659a74fd357a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 4 Nov 2012 08:31:14 -0800 Subject: [PATCH] Remove Base.has() in favor of now supported Object#hasOwnProperty. --- lib/bootstrap.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/bootstrap.js b/lib/bootstrap.js index a6dda5e4..f7466e99 100644 --- a/lib/bootstrap.js +++ b/lib/bootstrap.js @@ -14,13 +14,6 @@ var Base = new function() { // Bootstrap scope var hidden = /^(statics|generics|preserve|enumerable|prototype|toString|valueOf)$/, proto = Object.prototype, - /** - * Private function that checks if an object contains a given property. - * Naming it 'has' causes problems on Opera when defining - * Object.prototype.has, as the local version then seems to be overriden - * by that. Giving it a idfferent name fixes it. - */ - has = proto.hasOwnProperty, toString = proto.toString, proto = Array.prototype, isArray = Array.isArray = Array.isArray || function(obj) { @@ -80,7 +73,7 @@ var Base = new function() { // Bootstrap scope return get ? { get: get, set: obj.__lookupSetter__(name), enumerable: true, configurable: true } - : has.call(obj, name) + : obj.hasOwnProperty(name) ? { value: obj[name], enumerable: true, configurable: true, writable: true } : null; @@ -113,7 +106,7 @@ var Base = new function() { // Bootstrap scope // the property exists (name in dest) and store result in prev prev = preserve || func ? (val && val.get ? name in dest : dest[name]) : null; - if ((dontCheck || val !== undefined && has.call(src, name)) + if ((dontCheck || val !== undefined && src.hasOwnProperty(name)) && (!preserve || !prev)) { if (func) { if (prev && /\bthis\.base\b/.test(val)) { @@ -181,7 +174,7 @@ var Base = new function() { // Bootstrap scope if (src) { beans = []; for (var name in src) - if (has.call(src, name) && !hidden.test(name)) + if (src.hasOwnProperty(name) && !hidden.test(name)) field(name, null, true, generics); // IE (and some other browsers?) never enumerate these, even if // they are simply set on an object. Force their creation. Do not @@ -346,10 +339,6 @@ var Base = new function() { // Bootstrap scope describe: describe, iterator: iterator, - has: function(obj, name) { - return has.call(obj, name); - }, - check: function(obj) { return !!(obj || obj === 0); },