- From: Jovan Gerodetti <notifications@github.com>
- Date: Tue, 10 Jan 2017 23:21:29 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 11 January 2017 07:22:02 UTC
I'm sorry if this has already been discussed, but I stumbled over this yesterday and it seemed like a pain point to me.
Right now the spec seems to force everyone to use constructor functions in order to create a custom element. This looks really weird in an prototype based language. I can understand that it was meant to make the usage of this API simple, but I hope you could also consider to make this API fit into the language...
If `define()` would do something like this:
```JavaScript
define(name, prototype) {
prototype = typeof prototype === 'function' ? prototype.prototype : prototype;
let instance = Object.create(prototype);
prototype.constructor.apply(instance, [...]);
}
```
It would be possible to submit either an Object which provides the required functions or a constructor function.
Correct me if I'm wrong, but I never came a cross any browser API that required the use of constructor functions before. Usually objects or normal functions are expected.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/621
Received on Wednesday, 11 January 2017 07:22:02 UTC