Where is it specified that new objects are empty, if it is?

Kevin Reid kpreid at google.com
Fri Mar 15 16:00:50 PDT 2013


I'm doing a little maintenance on SES. Chrome has recently added a new
odd behavior:

> var o = Object.create(null);
> Object.getOwnPropertyNames(o)
[]
> Object.getOwnPropertyDescriptor(o, '__proto__');
Object {value: null, writable: true, enumerable: false, configurable: false}

The two results are clearly non-conformant, in that gOPN and gOPD
should be consistent with each other. However, the problem that I'm
wanting to record accurately is the fact that Object.create(null) has
(however inconsistently) any properties at all (thus interfering with
table-like uses).

15.2.3.5 Object.create refers to 15.2.2.1 which specifies “a newly
created native ECMAScript object”. Where is the initial state of the
collection of properties of a “newly created” object specified? (8.6
defining the Object type doesn't say anything about the existence of
non-internal properties.)

(I recognize that this behavior may well be a deliberate variance to
reconcile __proto__ and ES5/ES6. This is not a complaint; this is a
request to consult spec-lawyers.)


More information about the es-discuss mailing list