Re: [whatwg] Opinions on window.console = "foo", and other oddities of window.console

From: Domenic Denicola
> So I think the plan of record is: `attribute any console`, with prose describing
> how the getter returns "the window's console object" which is initially set to
> a new instance of Console, but the setter can change it to any value. This
> means accessor descriptors and enumerable, since that's how IDL works. If
> anyone thinks this is bad, let us know. Otherwise the standard will be
> updated any day now in that direction.

In IRC, Smaug makes me aware of the [Replaceable] IDL attribute, which appears to be what Gecko does. Given `[Replaceable] readonly attribute Console console`, IDL auto-generates a setter that does (essentially) `this.defineOwnProperty("console", { value, writable: true, enumerable: true, configurable: true })`. For most objects this will shadow the prototype's getter, but for global objects like Window it will just overwrite it.

So, new plan of record: `[Replaceable] readonly attribute Console console`.

Received on Tuesday, 9 February 2016 00:10:44 UTC