-
Notifications
You must be signed in to change notification settings - Fork 387
Open
Description
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?
Metadata
Metadata
Assignees
Labels
No labels