Re: [w3c/webcomponents] How to define APIs only for custom element authors (#758)

Hm... I guess another option is make `HTMLElement`'s constructor take an argument. So you do:
```js
class MyElement extends HTMLElement {
    constructor() {
        const myInternal = new ElementInternal;
        super(myInternal);
    }
}
```
That's pretty funky. It would mean that `ElementInternal` (I don't think it's a good name but for the purpose of discussing the semantics, I'd use this name) would have a pre-attachment / pre-construction state too. I guess `element.attachElementInternal()` which would throw on a second invocation would be fine... that would be analogous to how shadow DOM API would work. Custom elements that don't use it can either attach it and never use it, or we could make this an opt-in feature where you'd have to declare it in a static field like we did for `observedAttributes`.

-- 
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/758#issuecomment-428814046

Received on Thursday, 11 October 2018 04:10:03 UTC