From: Alexander Ebert Date: Fri, 29 May 2015 22:14:28 +0000 (+0200) Subject: Improved check for plain objects X-Git-Tag: 3.0.0_Beta_1~2304 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=87d33e2caf997c568da5d4d340d30a242e1d7ac1;p=GitHub%2FWoltLab%2FWCF.git Improved check for plain objects --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Core.js b/wcfsetup/install/files/js/WoltLab/WCF/Core.js index cd8649a37b..b37850c543 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Core.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Core.js @@ -125,15 +125,11 @@ define([], function() { * @returns {boolean} true if target is an object literal */ isPlainObject: function(obj) { - if (obj === window || obj.nodeType) { + if (typeof obj !== 'object' || obj === null || obj.nodeType) { return false; } - if (obj.constructor && !obj.constructor.prototype.hasOwnProperty('isPrototypeOf')) { - return false; - } - - return true; + return (Object.getPrototypeOf(obj) === Object.prototype); }, /**