W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2016

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

From: Domenic Denicola <d@domenic.me>
Date: Tue, 9 Feb 2016 00:10:12 +0000
To: "whatwg@whatwg.org" <whatwg@whatwg.org>
Message-ID: <CY1PR0501MB1369B7A570BFA96ED9FA42CCDFD60@CY1PR0501MB1369.namprd05.prod.outlook.com>
Cc: "terin@terinstock.com" <terin@terinstock.com>, Travis Leithead <travis.leithead@microsoft.com>, Robert Kowalski <rok@kowalski.gd>
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

This archive was generated by hypermail 2.3.1 : Tuesday, 9 February 2016 00:10:44 UTC