fix hasOwnProperty

Some items, like html elements, could cause an error in the
hasOwnProperty function.
This commit is contained in:
mike 2016-06-25 16:11:47 -04:00
parent ec87369a6e
commit 9c4608cd5f
3 changed files with 89 additions and 77 deletions

View File

@ -175,8 +175,14 @@ dat.utils.common = (function () {
hasOwnProperty: function (obj, prop) {
var proto = obj.__proto__ || obj.constructor.prototype;
var proto_prop = undefined;
try {
proto_prop = proto[prop];
} catch (err) {
console.warn('property "' + prop + '" is unaccessible in prototype of object', obj);
}
return (prop in obj) &&
(!(prop in proto) || (proto[prop] !== obj[prop]));
(!(prop in proto) || (proto_prop !== obj[prop]));
}
};

150
build/dat.gui.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -136,8 +136,14 @@ define([], function () {
hasOwnProperty: function (obj, prop) {
var proto = obj.__proto__ || obj.constructor.prototype;
var proto_prop = undefined;
try {
proto_prop = proto[prop];
} catch (err) {
console.warn('property "' + prop + '" is unaccessible in prototype of object', obj);
}
return (prop in obj) &&
(!(prop in proto) || (proto[prop] !== obj[prop]));
(!(prop in proto) || (proto_prop !== obj[prop]));
}
};