Skip to content

Commit

Permalink
Merge pull request #215 from ljharb/clean_up_sham_getprototypeof
Browse files Browse the repository at this point in the history
Attempting to clean up the getPrototypeOf sham logic
  • Loading branch information
ljharb committed Mar 30, 2014
2 parents 0ea39ab + 59f400f commit 58b97af
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions es5-sham.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
}

Expand Down

0 comments on commit 58b97af

Please sign in to comment.