Skip to content

Instantly share code, notes, and snippets.

@aadsm
Created November 17, 2011 22:24
Show Gist options
  • Select an option

  • Save aadsm/1374750 to your computer and use it in GitHub Desktop.

Select an option

Save aadsm/1374750 to your computer and use it in GitHub Desktop.
Object.defineProperty bug in IE10 (10.0.8102.0)
<!doctype html>
<!--
runnable version: http://jsfiddle.net/uVkHh/
Expected result:
Super.foo
foo: {
"value": "this.foo",
"writable": false,
"enumerable": false,
"configurable": false
}
this.foo
Current result:
Super.foo
foo: {
"value": "this.foo",
"writable": false,
"enumerable": false,
"configurable": false
}
Super.foo
-->
<script>
var Super = Object.create(Object.prototype, {
foo: {
configurable: true,
get: function() {
Object.defineProperty(this, "foo", {
value: "this.foo"
});
return "Super.foo";
},
set: function() {}
}
});
var o = Object.create(Super);
console.log("o.foo: " + o.foo);
console.log("foo descriptor: ", JSON.stringify(Object.getOwnPropertyDescriptor(o, "foo"), null, " "));
console.log("o.foo: " + o.foo);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment