- From: Sergey Polyatykin <notifications@github.com>
- Date: Mon, 30 Dec 2019 13:51:29 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 30 December 2019 21:51:32 UTC
The idea is to add a setter for `ElementInternals.states`, that forwarding values into the setter of `ElementInternals.states.value` as done in `Element.classList`.
Example with setter `Element.classList`:
```JavaScript
element.classList = 'foo bar baz'
// equals:
element.classList.value = 'foo bar baz'
```
Example with the proposed setter `ElementInternals.states`:
```JavaScript
// According to current specification is readonly and throws an error.
elementInternals.states = 'foo bar baz'
// equals:
elementInternals.states.value = 'foo bar baz'
```
This may allow setting initial values to `ElementInternals` including `ElementInternals.states` using `Object.assign` for example. At the moment, this code will throw an error.
```JavaScript
class extends HTMLElement {
#internals = Object.assign(this.attachInternals(), {
role: 'button',
states: 'pressed',
})
}
```
--
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/862
Received on Monday, 30 December 2019 21:51:32 UTC