- From: Domenic Denicola via GitHub <sysbot+gh@w3.org>
- Date: Mon, 18 May 2015 15:53:49 +0000
- To: public-device-apis@w3.org
Isn't this exactly what omitting [Constructor] gives you? Every non-[Constructor] interface actually has a constructor. (It's impossible to create a class in JavaScript without one.) It just throws when used. And yet things derive from non-[Constructor] classes, using their initialization logic (branding, etc.). Examples of this abound. Just in DOM there are a bunch of constructible classes which derive from CharacterData, which is not constructible (and neither is its superclass, Node). But they still count as CharacterData instances for brand-checking purposes, so their constructor must have been run. So I think this is already covered just by omitting [Constructor]. P.S. `if (Object.getPrototypeOf(this) === AbstractSensor.prototype)` is not a good test. I can fool it like so: ```js var o = Object.create(AbstractSensor.prototype); AbstractSensor.call(o); ``` You'd want to test `new.target` more likely. Although even that is fool-able with `Reflect.construct`. -- GitHub Notif of comment by domenic See https://github.com/w3c/sensors/issues/19#issuecomment-103112229
Received on Monday, 18 May 2015 15:53:50 UTC