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

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

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Mon, 8 Feb 2016 16:11:42 -0800
Message-ID: <CABZUbM3rbG6Y5wc6z2eMgBYxJoW5ZB56tJZCjqnzhUfETZaX1A@mail.gmail.com>
To: Domenic Denicola <d@domenic.me>
Cc: "whatwg@whatwg.org" <whatwg@whatwg.org>, "terin@terinstock.com" <terin@terinstock.com>, Robert Kowalski <rok@kowalski.gd>, Travis Leithead <travis.leithead@microsoft.com>
Generally it should be fine to ask (for any normal person), though
doing a web search first to see if whatever it is caught your
curiousity isn't already covered on stackoverflow, etc is still a good

On Mon, Feb 8, 2016 at 4:10 PM, Domenic Denicola <d@domenic.me> wrote:
> 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:12:20 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 9 February 2016 00:12:20 UTC