From 59f400fe5a92410588b2d731e97f58338cd38c65 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 29 Mar 2014 16:46:02 -0700 Subject: [PATCH] Attempting to clean up the getPrototypeOf sham logic --- es5-sham.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/es5-sham.js b/es5-sham.js index 2a7d866a..f2970566 100644 --- a/es5-sham.js +++ b/es5-sham.js @@ -52,9 +52,13 @@ if (!Object.getPrototypeOf) { // ... Opera Mini breaks here with infinite loops Object.getPrototypeOf = function getPrototypeOf(object) { var proto = object.__proto__; - return (proto || (proto === null && proto)) || ( - object.constructor ? object.constructor.prototype : prototypeOfObject - ); + if (proto || proto === null) { + return proto; + } else if (object.constructor) { + return object.constructor.prototype; + } else { + return prototypeOfObject; + } }; }