From 87d33e2caf997c568da5d4d340d30a242e1d7ac1 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 30 May 2015 00:14:28 +0200 Subject: [PATCH] Improved check for plain objects --- wcfsetup/install/files/js/WoltLab/WCF/Core.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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); }, /** -- 2.20.1