mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
fix hasOwnProperty
Some items, like html elements, could cause an error in the hasOwnProperty function.
This commit is contained in:
parent
ec87369a6e
commit
9c4608cd5f
@ -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
150
build/dat.gui.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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]));
|
||||
}
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user