Re: [WICG/webcomponents] [element-internals] How to get internals in base class and subclass, without leaking it to public (Issue #962)

> ```js
> customElements.define('my-el', class extends HTMLElement {
> static get disabledFeatures() { return ['internals']; }
> })
> document.createElement('my-el').attachInternals() // throws
> ```

That API seems backwards. Perhaps it should have been this:

```js
customElements.define('my-el', class extends HTMLElement {})
document.createElement('my-el').attachInternals() // throws
```

```js
customElements.define('my-el', class extends HTMLElement {
  static enabledFeatures = ['internals']
})
document.createElement('my-el').attachInternals() // does not throw
```

But that's tangential anyway. Once the feature is available, protecting it is difficult.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/962#issuecomment-1199948014
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/962/1199948014@github.com>

Received on Friday, 29 July 2022 21:11:30 UTC