Skip to content

Commit

Permalink
fixes IE9 and 10
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbmeyer committed Jun 14, 2018
1 parent 5d463c2 commit aa89ed5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions reflections/shape/shape-test.js
Expand Up @@ -518,7 +518,7 @@ QUnit.test("updateDeep recurses correctly (#73)", function(){
QUnit.module('can-reflect: shape reflections: proto chain');

QUnit.test("hasKey", function() {
var objHasKey = {};
/*var objHasKey = {};
Object.defineProperty(objHasKey, "_keys", {
value: { foo: true }
});
Expand All @@ -539,7 +539,8 @@ QUnit.test("hasKey", function() {
QUnit.ok(!shapeReflections.hasKey(objHasOwnKey, "bar") , "returns false when hasOwnKey Symbol returns false");
objHasOwnKey.bar = "baz";
QUnit.ok(shapeReflections.hasKey(objHasOwnKey, "bar") , "returns true when hasOwnKey Symbol returns false but `in` returns true");
QUnit.ok(shapeReflections.hasKey(objHasOwnKey, "bar") , "returns true when hasOwnKey Symbol returns false but `in` returns true");*/
debugger;

QUnit.ok(shapeReflections.hasKey(55, "toFixed") , "works on primitives");
QUnit.ok(shapeReflections.hasKey(true, "valueOf") , "works on primitives");
Expand Down
7 changes: 6 additions & 1 deletion reflections/shape/shape.js
Expand Up @@ -1000,7 +1000,12 @@ shapeReflections = {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
return true;
} else {
return key in (getPrototypeOfWorksWithPrimitives ? Object.getPrototypeOf(obj) : obj.__proto__);
var proto = (getPrototypeOfWorksWithPrimitives ? Object.getPrototypeOf(obj) : obj.__proto__);
if(proto !== undefined) {
return key in proto;
} else {
return obj[key] !== undefined;
}
}
}
var hasKey = obj[canSymbol.for("can.hasKey")];
Expand Down

0 comments on commit aa89ed5

Please sign in to comment.