Remove Base.has() in favor of now supported Object#hasOwnProperty.

This commit is contained in:
Jürg Lehni 2012-11-04 08:31:14 -08:00
parent 0eaabd667c
commit 9ec5ad29ef

17
lib/bootstrap.js vendored
View file

@ -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);
},