- From: Westbrook Johnson <notifications@github.com>
- Date: Tue, 19 Aug 2025 06:48:16 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 19 August 2025 13:48:20 UTC
Westbrook created an issue (WICG/webcomponents#1110) Currently when wanting to add/delete a CSS Custom State to the CustomStateSet you need to do something like the following: ``` if (value) { this.internals.states.add(state); } else { this.internals.states.delete(state); } ``` When a custom element sets out to manage this state once, this is not too big of a deal, however as an author looks to manage this state from more locations you end up wanting for a helper method to support managing this: ``` setState(state, value) { if (value) { this.internals.states.add(state); } else { this.internals.states.delete(state); } } ``` It's not the most complicated boilerplate required by the various Web Components APIs, but it's an added bit of complexity for authors to spend limited decisions making faculties on. Was there a specific reason not to include a `toggle(state, value)` method? With this we'd be able to simplify this usage to: ``` this.internals.states.toggle(state, value); ``` Would there be room to include such an expansion on the CustomStateSet object? -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/1110 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/1110@github.com>
Received on Tuesday, 19 August 2025 13:48:20 UTC